1
|
|
|
/******/ (function(modules) { // webpackBootstrap |
2
|
|
|
/******/ // The module cache |
3
|
|
|
/******/ var installedModules = {}; |
4
|
|
|
/******/ |
5
|
|
|
/******/ // The require function |
6
|
|
|
/******/ function __webpack_require__(moduleId) { |
7
|
|
|
/******/ |
8
|
|
|
/******/ // Check if module is in cache |
9
|
|
|
/******/ if(installedModules[moduleId]) { |
10
|
|
|
/******/ return installedModules[moduleId].exports; |
11
|
|
|
/******/ } |
12
|
|
|
/******/ // Create a new module (and put it into the cache) |
13
|
|
|
/******/ var module = installedModules[moduleId] = { |
14
|
|
|
/******/ i: moduleId, |
15
|
|
|
/******/ l: false, |
16
|
|
|
/******/ exports: {} |
17
|
|
|
/******/ }; |
18
|
|
|
/******/ |
19
|
|
|
/******/ // Execute the module function |
20
|
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
21
|
|
|
/******/ |
22
|
|
|
/******/ // Flag the module as loaded |
23
|
|
|
/******/ module.l = true; |
24
|
|
|
/******/ |
25
|
|
|
/******/ // Return the exports of the module |
26
|
|
|
/******/ return module.exports; |
27
|
|
|
/******/ } |
28
|
|
|
/******/ |
29
|
|
|
/******/ |
30
|
|
|
/******/ // expose the modules object (__webpack_modules__) |
31
|
|
|
/******/ __webpack_require__.m = modules; |
32
|
|
|
/******/ |
33
|
|
|
/******/ // expose the module cache |
34
|
|
|
/******/ __webpack_require__.c = installedModules; |
35
|
|
|
/******/ |
36
|
|
|
/******/ // define getter function for harmony exports |
37
|
|
|
/******/ __webpack_require__.d = function(exports, name, getter) { |
38
|
|
|
/******/ if(!__webpack_require__.o(exports, name)) { |
39
|
|
|
/******/ Object.defineProperty(exports, name, { |
40
|
|
|
/******/ configurable: false, |
41
|
|
|
/******/ enumerable: true, |
42
|
|
|
/******/ get: getter |
43
|
|
|
/******/ }); |
44
|
|
|
/******/ } |
45
|
|
|
/******/ }; |
46
|
|
|
/******/ |
47
|
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules |
48
|
|
|
/******/ __webpack_require__.n = function(module) { |
49
|
|
|
/******/ var getter = module && module.__esModule ? |
50
|
|
|
/******/ function getDefault() { return module['default']; } : |
51
|
|
|
/******/ function getModuleExports() { return module; }; |
52
|
|
|
/******/ __webpack_require__.d(getter, 'a', getter); |
53
|
|
|
/******/ return getter; |
54
|
|
|
/******/ }; |
55
|
|
|
/******/ |
56
|
|
|
/******/ // Object.prototype.hasOwnProperty.call |
57
|
|
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
58
|
|
|
/******/ |
59
|
|
|
/******/ // __webpack_public_path__ |
60
|
|
|
/******/ __webpack_require__.p = "/"; |
61
|
|
|
/******/ |
62
|
|
|
/******/ // Load entry module and return exports |
63
|
|
|
/******/ return __webpack_require__(__webpack_require__.s = 0); |
64
|
|
|
/******/ }) |
65
|
|
|
/************************************************************************/ |
66
|
|
|
/******/ ({ |
67
|
|
|
|
68
|
|
|
/***/ "./node_modules/axios/index.js": |
69
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
70
|
|
|
|
71
|
|
|
module.exports = __webpack_require__("./node_modules/axios/lib/axios.js"); |
72
|
|
|
|
73
|
|
|
/***/ }), |
74
|
|
|
|
75
|
|
|
/***/ "./node_modules/axios/lib/adapters/xhr.js": |
76
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
77
|
|
|
|
78
|
|
|
"use strict"; |
79
|
|
|
|
80
|
|
|
|
81
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
82
|
|
|
var settle = __webpack_require__("./node_modules/axios/lib/core/settle.js"); |
83
|
|
|
var buildURL = __webpack_require__("./node_modules/axios/lib/helpers/buildURL.js"); |
84
|
|
|
var parseHeaders = __webpack_require__("./node_modules/axios/lib/helpers/parseHeaders.js"); |
85
|
|
|
var isURLSameOrigin = __webpack_require__("./node_modules/axios/lib/helpers/isURLSameOrigin.js"); |
86
|
|
|
var createError = __webpack_require__("./node_modules/axios/lib/core/createError.js"); |
87
|
|
|
var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__("./node_modules/axios/lib/helpers/btoa.js"); |
88
|
|
|
|
89
|
|
|
module.exports = function xhrAdapter(config) { |
90
|
|
|
return new Promise(function dispatchXhrRequest(resolve, reject) { |
91
|
|
|
var requestData = config.data; |
92
|
|
|
var requestHeaders = config.headers; |
93
|
|
|
|
94
|
|
|
if (utils.isFormData(requestData)) { |
95
|
|
|
delete requestHeaders['Content-Type']; // Let the browser set it |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
var request = new XMLHttpRequest(); |
99
|
|
|
var loadEvent = 'onreadystatechange'; |
100
|
|
|
var xDomain = false; |
101
|
|
|
|
102
|
|
|
// For IE 8/9 CORS support |
103
|
|
|
// Only supports POST and GET calls and doesn't returns the response headers. |
104
|
|
|
// DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest. |
105
|
|
|
if ("development" !== 'test' && |
106
|
|
|
typeof window !== 'undefined' && |
107
|
|
|
window.XDomainRequest && !('withCredentials' in request) && |
108
|
|
|
!isURLSameOrigin(config.url)) { |
109
|
|
|
request = new window.XDomainRequest(); |
110
|
|
|
loadEvent = 'onload'; |
111
|
|
|
xDomain = true; |
112
|
|
|
request.onprogress = function handleProgress() {}; |
113
|
|
|
request.ontimeout = function handleTimeout() {}; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
// HTTP basic authentication |
117
|
|
|
if (config.auth) { |
118
|
|
|
var username = config.auth.username || ''; |
119
|
|
|
var password = config.auth.password || ''; |
120
|
|
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); |
124
|
|
|
|
125
|
|
|
// Set the request timeout in MS |
126
|
|
|
request.timeout = config.timeout; |
127
|
|
|
|
128
|
|
|
// Listen for ready state |
129
|
|
|
request[loadEvent] = function handleLoad() { |
130
|
|
|
if (!request || (request.readyState !== 4 && !xDomain)) { |
131
|
|
|
return; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
// The request errored out and we didn't get a response, this will be |
135
|
|
|
// handled by onerror instead |
136
|
|
|
// With one exception: request that using file: protocol, most browsers |
137
|
|
|
// will return status as 0 even though it's a successful request |
138
|
|
|
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { |
139
|
|
|
return; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
// Prepare the response |
143
|
|
|
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; |
144
|
|
|
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; |
145
|
|
|
var response = { |
146
|
|
|
data: responseData, |
147
|
|
|
// IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201) |
148
|
|
|
status: request.status === 1223 ? 204 : request.status, |
149
|
|
|
statusText: request.status === 1223 ? 'No Content' : request.statusText, |
150
|
|
|
headers: responseHeaders, |
151
|
|
|
config: config, |
152
|
|
|
request: request |
153
|
|
|
}; |
154
|
|
|
|
155
|
|
|
settle(resolve, reject, response); |
156
|
|
|
|
157
|
|
|
// Clean up request |
158
|
|
|
request = null; |
159
|
|
|
}; |
160
|
|
|
|
161
|
|
|
// Handle low level network errors |
162
|
|
|
request.onerror = function handleError() { |
163
|
|
|
// Real errors are hidden from us by the browser |
164
|
|
|
// onerror should only fire if it's a network error |
165
|
|
|
reject(createError('Network Error', config, null, request)); |
166
|
|
|
|
167
|
|
|
// Clean up request |
168
|
|
|
request = null; |
169
|
|
|
}; |
170
|
|
|
|
171
|
|
|
// Handle timeout |
172
|
|
|
request.ontimeout = function handleTimeout() { |
173
|
|
|
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', |
174
|
|
|
request)); |
175
|
|
|
|
176
|
|
|
// Clean up request |
177
|
|
|
request = null; |
178
|
|
|
}; |
179
|
|
|
|
180
|
|
|
// Add xsrf header |
181
|
|
|
// This is only done if running in a standard browser environment. |
182
|
|
|
// Specifically not if we're in a web worker, or react-native. |
183
|
|
|
if (utils.isStandardBrowserEnv()) { |
184
|
|
|
var cookies = __webpack_require__("./node_modules/axios/lib/helpers/cookies.js"); |
185
|
|
|
|
186
|
|
|
// Add xsrf header |
187
|
|
|
var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ? |
188
|
|
|
cookies.read(config.xsrfCookieName) : |
189
|
|
|
undefined; |
190
|
|
|
|
191
|
|
|
if (xsrfValue) { |
192
|
|
|
requestHeaders[config.xsrfHeaderName] = xsrfValue; |
193
|
|
|
} |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
// Add headers to the request |
197
|
|
|
if ('setRequestHeader' in request) { |
198
|
|
|
utils.forEach(requestHeaders, function setRequestHeader(val, key) { |
199
|
|
|
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { |
200
|
|
|
// Remove Content-Type if data is undefined |
201
|
|
|
delete requestHeaders[key]; |
202
|
|
|
} else { |
203
|
|
|
// Otherwise add header to the request |
204
|
|
|
request.setRequestHeader(key, val); |
205
|
|
|
} |
206
|
|
|
}); |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
// Add withCredentials to request if needed |
210
|
|
|
if (config.withCredentials) { |
211
|
|
|
request.withCredentials = true; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
// Add responseType to request if needed |
215
|
|
|
if (config.responseType) { |
216
|
|
|
try { |
217
|
|
|
request.responseType = config.responseType; |
218
|
|
|
} catch (e) { |
219
|
|
|
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. |
220
|
|
|
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. |
221
|
|
|
if (config.responseType !== 'json') { |
222
|
|
|
throw e; |
223
|
|
|
} |
224
|
|
|
} |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
// Handle progress if needed |
228
|
|
|
if (typeof config.onDownloadProgress === 'function') { |
229
|
|
|
request.addEventListener('progress', config.onDownloadProgress); |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
// Not all browsers support upload events |
233
|
|
|
if (typeof config.onUploadProgress === 'function' && request.upload) { |
234
|
|
|
request.upload.addEventListener('progress', config.onUploadProgress); |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
if (config.cancelToken) { |
238
|
|
|
// Handle cancellation |
239
|
|
|
config.cancelToken.promise.then(function onCanceled(cancel) { |
240
|
|
|
if (!request) { |
241
|
|
|
return; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
request.abort(); |
245
|
|
|
reject(cancel); |
246
|
|
|
// Clean up request |
247
|
|
|
request = null; |
248
|
|
|
}); |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
if (requestData === undefined) { |
252
|
|
|
requestData = null; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
// Send the request |
256
|
|
|
request.send(requestData); |
257
|
|
|
}); |
258
|
|
|
}; |
259
|
|
|
|
260
|
|
|
|
261
|
|
|
/***/ }), |
262
|
|
|
|
263
|
|
|
/***/ "./node_modules/axios/lib/axios.js": |
264
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
265
|
|
|
|
266
|
|
|
"use strict"; |
267
|
|
|
|
268
|
|
|
|
269
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
270
|
|
|
var bind = __webpack_require__("./node_modules/axios/lib/helpers/bind.js"); |
271
|
|
|
var Axios = __webpack_require__("./node_modules/axios/lib/core/Axios.js"); |
272
|
|
|
var defaults = __webpack_require__("./node_modules/axios/lib/defaults.js"); |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* Create an instance of Axios |
276
|
|
|
* |
277
|
|
|
* @param {Object} defaultConfig The default config for the instance |
278
|
|
|
* @return {Axios} A new instance of Axios |
279
|
|
|
*/ |
280
|
|
|
function createInstance(defaultConfig) { |
281
|
|
|
var context = new Axios(defaultConfig); |
282
|
|
|
var instance = bind(Axios.prototype.request, context); |
283
|
|
|
|
284
|
|
|
// Copy axios.prototype to instance |
285
|
|
|
utils.extend(instance, Axios.prototype, context); |
286
|
|
|
|
287
|
|
|
// Copy context to instance |
288
|
|
|
utils.extend(instance, context); |
289
|
|
|
|
290
|
|
|
return instance; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
// Create the default instance to be exported |
294
|
|
|
var axios = createInstance(defaults); |
295
|
|
|
|
296
|
|
|
// Expose Axios class to allow class inheritance |
297
|
|
|
axios.Axios = Axios; |
298
|
|
|
|
299
|
|
|
// Factory for creating new instances |
300
|
|
|
axios.create = function create(instanceConfig) { |
301
|
|
|
return createInstance(utils.merge(defaults, instanceConfig)); |
302
|
|
|
}; |
303
|
|
|
|
304
|
|
|
// Expose Cancel & CancelToken |
305
|
|
|
axios.Cancel = __webpack_require__("./node_modules/axios/lib/cancel/Cancel.js"); |
306
|
|
|
axios.CancelToken = __webpack_require__("./node_modules/axios/lib/cancel/CancelToken.js"); |
307
|
|
|
axios.isCancel = __webpack_require__("./node_modules/axios/lib/cancel/isCancel.js"); |
308
|
|
|
|
309
|
|
|
// Expose all/spread |
310
|
|
|
axios.all = function all(promises) { |
311
|
|
|
return Promise.all(promises); |
312
|
|
|
}; |
313
|
|
|
axios.spread = __webpack_require__("./node_modules/axios/lib/helpers/spread.js"); |
314
|
|
|
|
315
|
|
|
module.exports = axios; |
316
|
|
|
|
317
|
|
|
// Allow use of default import syntax in TypeScript |
318
|
|
|
module.exports.default = axios; |
319
|
|
|
|
320
|
|
|
|
321
|
|
|
/***/ }), |
322
|
|
|
|
323
|
|
|
/***/ "./node_modules/axios/lib/cancel/Cancel.js": |
324
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
325
|
|
|
|
326
|
|
|
"use strict"; |
327
|
|
|
|
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* A `Cancel` is an object that is thrown when an operation is canceled. |
331
|
|
|
* |
332
|
|
|
* @class |
333
|
|
|
* @param {string=} message The message. |
334
|
|
|
*/ |
335
|
|
|
function Cancel(message) { |
336
|
|
|
this.message = message; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
Cancel.prototype.toString = function toString() { |
340
|
|
|
return 'Cancel' + (this.message ? ': ' + this.message : ''); |
341
|
|
|
}; |
342
|
|
|
|
343
|
|
|
Cancel.prototype.__CANCEL__ = true; |
344
|
|
|
|
345
|
|
|
module.exports = Cancel; |
346
|
|
|
|
347
|
|
|
|
348
|
|
|
/***/ }), |
349
|
|
|
|
350
|
|
|
/***/ "./node_modules/axios/lib/cancel/CancelToken.js": |
351
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
352
|
|
|
|
353
|
|
|
"use strict"; |
354
|
|
|
|
355
|
|
|
|
356
|
|
|
var Cancel = __webpack_require__("./node_modules/axios/lib/cancel/Cancel.js"); |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* A `CancelToken` is an object that can be used to request cancellation of an operation. |
360
|
|
|
* |
361
|
|
|
* @class |
362
|
|
|
* @param {Function} executor The executor function. |
363
|
|
|
*/ |
364
|
|
|
function CancelToken(executor) { |
365
|
|
|
if (typeof executor !== 'function') { |
366
|
|
|
throw new TypeError('executor must be a function.'); |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
var resolvePromise; |
370
|
|
|
this.promise = new Promise(function promiseExecutor(resolve) { |
371
|
|
|
resolvePromise = resolve; |
372
|
|
|
}); |
373
|
|
|
|
374
|
|
|
var token = this; |
375
|
|
|
executor(function cancel(message) { |
376
|
|
|
if (token.reason) { |
377
|
|
|
// Cancellation has already been requested |
378
|
|
|
return; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
token.reason = new Cancel(message); |
382
|
|
|
resolvePromise(token.reason); |
383
|
|
|
}); |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
/** |
387
|
|
|
* Throws a `Cancel` if cancellation has been requested. |
388
|
|
|
*/ |
389
|
|
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() { |
390
|
|
|
if (this.reason) { |
391
|
|
|
throw this.reason; |
392
|
|
|
} |
393
|
|
|
}; |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* Returns an object that contains a new `CancelToken` and a function that, when called, |
397
|
|
|
* cancels the `CancelToken`. |
398
|
|
|
*/ |
399
|
|
|
CancelToken.source = function source() { |
400
|
|
|
var cancel; |
401
|
|
|
var token = new CancelToken(function executor(c) { |
402
|
|
|
cancel = c; |
403
|
|
|
}); |
404
|
|
|
return { |
405
|
|
|
token: token, |
406
|
|
|
cancel: cancel |
407
|
|
|
}; |
408
|
|
|
}; |
409
|
|
|
|
410
|
|
|
module.exports = CancelToken; |
411
|
|
|
|
412
|
|
|
|
413
|
|
|
/***/ }), |
414
|
|
|
|
415
|
|
|
/***/ "./node_modules/axios/lib/cancel/isCancel.js": |
416
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
417
|
|
|
|
418
|
|
|
"use strict"; |
419
|
|
|
|
420
|
|
|
|
421
|
|
|
module.exports = function isCancel(value) { |
422
|
|
|
return !!(value && value.__CANCEL__); |
423
|
|
|
}; |
424
|
|
|
|
425
|
|
|
|
426
|
|
|
/***/ }), |
427
|
|
|
|
428
|
|
|
/***/ "./node_modules/axios/lib/core/Axios.js": |
429
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
430
|
|
|
|
431
|
|
|
"use strict"; |
432
|
|
|
|
433
|
|
|
|
434
|
|
|
var defaults = __webpack_require__("./node_modules/axios/lib/defaults.js"); |
435
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
436
|
|
|
var InterceptorManager = __webpack_require__("./node_modules/axios/lib/core/InterceptorManager.js"); |
437
|
|
|
var dispatchRequest = __webpack_require__("./node_modules/axios/lib/core/dispatchRequest.js"); |
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* Create a new instance of Axios |
441
|
|
|
* |
442
|
|
|
* @param {Object} instanceConfig The default config for the instance |
443
|
|
|
*/ |
444
|
|
|
function Axios(instanceConfig) { |
445
|
|
|
this.defaults = instanceConfig; |
446
|
|
|
this.interceptors = { |
447
|
|
|
request: new InterceptorManager(), |
448
|
|
|
response: new InterceptorManager() |
449
|
|
|
}; |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* Dispatch a request |
454
|
|
|
* |
455
|
|
|
* @param {Object} config The config specific for this request (merged with this.defaults) |
456
|
|
|
*/ |
457
|
|
|
Axios.prototype.request = function request(config) { |
458
|
|
|
/*eslint no-param-reassign:0*/ |
459
|
|
|
// Allow for axios('example/url'[, config]) a la fetch API |
460
|
|
|
if (typeof config === 'string') { |
461
|
|
|
config = utils.merge({ |
462
|
|
|
url: arguments[0] |
463
|
|
|
}, arguments[1]); |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
config = utils.merge(defaults, this.defaults, { method: 'get' }, config); |
467
|
|
|
config.method = config.method.toLowerCase(); |
468
|
|
|
|
469
|
|
|
// Hook up interceptors middleware |
470
|
|
|
var chain = [dispatchRequest, undefined]; |
471
|
|
|
var promise = Promise.resolve(config); |
472
|
|
|
|
473
|
|
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { |
474
|
|
|
chain.unshift(interceptor.fulfilled, interceptor.rejected); |
475
|
|
|
}); |
476
|
|
|
|
477
|
|
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { |
478
|
|
|
chain.push(interceptor.fulfilled, interceptor.rejected); |
479
|
|
|
}); |
480
|
|
|
|
481
|
|
|
while (chain.length) { |
482
|
|
|
promise = promise.then(chain.shift(), chain.shift()); |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
return promise; |
486
|
|
|
}; |
487
|
|
|
|
488
|
|
|
// Provide aliases for supported request methods |
489
|
|
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { |
490
|
|
|
/*eslint func-names:0*/ |
491
|
|
|
Axios.prototype[method] = function(url, config) { |
492
|
|
|
return this.request(utils.merge(config || {}, { |
493
|
|
|
method: method, |
494
|
|
|
url: url |
495
|
|
|
})); |
496
|
|
|
}; |
497
|
|
|
}); |
498
|
|
|
|
499
|
|
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { |
500
|
|
|
/*eslint func-names:0*/ |
501
|
|
|
Axios.prototype[method] = function(url, data, config) { |
502
|
|
|
return this.request(utils.merge(config || {}, { |
503
|
|
|
method: method, |
504
|
|
|
url: url, |
505
|
|
|
data: data |
506
|
|
|
})); |
507
|
|
|
}; |
508
|
|
|
}); |
509
|
|
|
|
510
|
|
|
module.exports = Axios; |
511
|
|
|
|
512
|
|
|
|
513
|
|
|
/***/ }), |
514
|
|
|
|
515
|
|
|
/***/ "./node_modules/axios/lib/core/InterceptorManager.js": |
516
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
517
|
|
|
|
518
|
|
|
"use strict"; |
519
|
|
|
|
520
|
|
|
|
521
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
522
|
|
|
|
523
|
|
|
function InterceptorManager() { |
524
|
|
|
this.handlers = []; |
525
|
|
|
} |
526
|
|
|
|
527
|
|
|
/** |
528
|
|
|
* Add a new interceptor to the stack |
529
|
|
|
* |
530
|
|
|
* @param {Function} fulfilled The function to handle `then` for a `Promise` |
531
|
|
|
* @param {Function} rejected The function to handle `reject` for a `Promise` |
532
|
|
|
* |
533
|
|
|
* @return {Number} An ID used to remove interceptor later |
534
|
|
|
*/ |
535
|
|
|
InterceptorManager.prototype.use = function use(fulfilled, rejected) { |
536
|
|
|
this.handlers.push({ |
537
|
|
|
fulfilled: fulfilled, |
538
|
|
|
rejected: rejected |
539
|
|
|
}); |
540
|
|
|
return this.handlers.length - 1; |
541
|
|
|
}; |
542
|
|
|
|
543
|
|
|
/** |
544
|
|
|
* Remove an interceptor from the stack |
545
|
|
|
* |
546
|
|
|
* @param {Number} id The ID that was returned by `use` |
547
|
|
|
*/ |
548
|
|
|
InterceptorManager.prototype.eject = function eject(id) { |
549
|
|
|
if (this.handlers[id]) { |
550
|
|
|
this.handlers[id] = null; |
551
|
|
|
} |
552
|
|
|
}; |
553
|
|
|
|
554
|
|
|
/** |
555
|
|
|
* Iterate over all the registered interceptors |
556
|
|
|
* |
557
|
|
|
* This method is particularly useful for skipping over any |
558
|
|
|
* interceptors that may have become `null` calling `eject`. |
559
|
|
|
* |
560
|
|
|
* @param {Function} fn The function to call for each interceptor |
561
|
|
|
*/ |
562
|
|
|
InterceptorManager.prototype.forEach = function forEach(fn) { |
563
|
|
|
utils.forEach(this.handlers, function forEachHandler(h) { |
564
|
|
|
if (h !== null) { |
565
|
|
|
fn(h); |
566
|
|
|
} |
567
|
|
|
}); |
568
|
|
|
}; |
569
|
|
|
|
570
|
|
|
module.exports = InterceptorManager; |
571
|
|
|
|
572
|
|
|
|
573
|
|
|
/***/ }), |
574
|
|
|
|
575
|
|
|
/***/ "./node_modules/axios/lib/core/createError.js": |
576
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
577
|
|
|
|
578
|
|
|
"use strict"; |
579
|
|
|
|
580
|
|
|
|
581
|
|
|
var enhanceError = __webpack_require__("./node_modules/axios/lib/core/enhanceError.js"); |
582
|
|
|
|
583
|
|
|
/** |
584
|
|
|
* Create an Error with the specified message, config, error code, request and response. |
585
|
|
|
* |
586
|
|
|
* @param {string} message The error message. |
587
|
|
|
* @param {Object} config The config. |
588
|
|
|
* @param {string} [code] The error code (for example, 'ECONNABORTED'). |
589
|
|
|
* @param {Object} [request] The request. |
590
|
|
|
* @param {Object} [response] The response. |
591
|
|
|
* @returns {Error} The created error. |
592
|
|
|
*/ |
593
|
|
|
module.exports = function createError(message, config, code, request, response) { |
594
|
|
|
var error = new Error(message); |
595
|
|
|
return enhanceError(error, config, code, request, response); |
596
|
|
|
}; |
597
|
|
|
|
598
|
|
|
|
599
|
|
|
/***/ }), |
600
|
|
|
|
601
|
|
|
/***/ "./node_modules/axios/lib/core/dispatchRequest.js": |
602
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
603
|
|
|
|
604
|
|
|
"use strict"; |
605
|
|
|
|
606
|
|
|
|
607
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
608
|
|
|
var transformData = __webpack_require__("./node_modules/axios/lib/core/transformData.js"); |
609
|
|
|
var isCancel = __webpack_require__("./node_modules/axios/lib/cancel/isCancel.js"); |
610
|
|
|
var defaults = __webpack_require__("./node_modules/axios/lib/defaults.js"); |
611
|
|
|
var isAbsoluteURL = __webpack_require__("./node_modules/axios/lib/helpers/isAbsoluteURL.js"); |
612
|
|
|
var combineURLs = __webpack_require__("./node_modules/axios/lib/helpers/combineURLs.js"); |
613
|
|
|
|
614
|
|
|
/** |
615
|
|
|
* Throws a `Cancel` if cancellation has been requested. |
616
|
|
|
*/ |
617
|
|
|
function throwIfCancellationRequested(config) { |
618
|
|
|
if (config.cancelToken) { |
619
|
|
|
config.cancelToken.throwIfRequested(); |
620
|
|
|
} |
621
|
|
|
} |
622
|
|
|
|
623
|
|
|
/** |
624
|
|
|
* Dispatch a request to the server using the configured adapter. |
625
|
|
|
* |
626
|
|
|
* @param {object} config The config that is to be used for the request |
627
|
|
|
* @returns {Promise} The Promise to be fulfilled |
628
|
|
|
*/ |
629
|
|
|
module.exports = function dispatchRequest(config) { |
630
|
|
|
throwIfCancellationRequested(config); |
631
|
|
|
|
632
|
|
|
// Support baseURL config |
633
|
|
|
if (config.baseURL && !isAbsoluteURL(config.url)) { |
634
|
|
|
config.url = combineURLs(config.baseURL, config.url); |
635
|
|
|
} |
636
|
|
|
|
637
|
|
|
// Ensure headers exist |
638
|
|
|
config.headers = config.headers || {}; |
639
|
|
|
|
640
|
|
|
// Transform request data |
641
|
|
|
config.data = transformData( |
642
|
|
|
config.data, |
643
|
|
|
config.headers, |
644
|
|
|
config.transformRequest |
645
|
|
|
); |
646
|
|
|
|
647
|
|
|
// Flatten headers |
648
|
|
|
config.headers = utils.merge( |
649
|
|
|
config.headers.common || {}, |
650
|
|
|
config.headers[config.method] || {}, |
651
|
|
|
config.headers || {} |
652
|
|
|
); |
653
|
|
|
|
654
|
|
|
utils.forEach( |
655
|
|
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], |
656
|
|
|
function cleanHeaderConfig(method) { |
657
|
|
|
delete config.headers[method]; |
658
|
|
|
} |
659
|
|
|
); |
660
|
|
|
|
661
|
|
|
var adapter = config.adapter || defaults.adapter; |
662
|
|
|
|
663
|
|
|
return adapter(config).then(function onAdapterResolution(response) { |
664
|
|
|
throwIfCancellationRequested(config); |
665
|
|
|
|
666
|
|
|
// Transform response data |
667
|
|
|
response.data = transformData( |
668
|
|
|
response.data, |
669
|
|
|
response.headers, |
670
|
|
|
config.transformResponse |
671
|
|
|
); |
672
|
|
|
|
673
|
|
|
return response; |
674
|
|
|
}, function onAdapterRejection(reason) { |
675
|
|
|
if (!isCancel(reason)) { |
676
|
|
|
throwIfCancellationRequested(config); |
677
|
|
|
|
678
|
|
|
// Transform response data |
679
|
|
|
if (reason && reason.response) { |
680
|
|
|
reason.response.data = transformData( |
681
|
|
|
reason.response.data, |
682
|
|
|
reason.response.headers, |
683
|
|
|
config.transformResponse |
684
|
|
|
); |
685
|
|
|
} |
686
|
|
|
} |
687
|
|
|
|
688
|
|
|
return Promise.reject(reason); |
689
|
|
|
}); |
690
|
|
|
}; |
691
|
|
|
|
692
|
|
|
|
693
|
|
|
/***/ }), |
694
|
|
|
|
695
|
|
|
/***/ "./node_modules/axios/lib/core/enhanceError.js": |
696
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
697
|
|
|
|
698
|
|
|
"use strict"; |
699
|
|
|
|
700
|
|
|
|
701
|
|
|
/** |
702
|
|
|
* Update an Error with the specified config, error code, and response. |
703
|
|
|
* |
704
|
|
|
* @param {Error} error The error to update. |
705
|
|
|
* @param {Object} config The config. |
706
|
|
|
* @param {string} [code] The error code (for example, 'ECONNABORTED'). |
707
|
|
|
* @param {Object} [request] The request. |
708
|
|
|
* @param {Object} [response] The response. |
709
|
|
|
* @returns {Error} The error. |
710
|
|
|
*/ |
711
|
|
|
module.exports = function enhanceError(error, config, code, request, response) { |
712
|
|
|
error.config = config; |
713
|
|
|
if (code) { |
714
|
|
|
error.code = code; |
715
|
|
|
} |
716
|
|
|
error.request = request; |
717
|
|
|
error.response = response; |
718
|
|
|
return error; |
719
|
|
|
}; |
720
|
|
|
|
721
|
|
|
|
722
|
|
|
/***/ }), |
723
|
|
|
|
724
|
|
|
/***/ "./node_modules/axios/lib/core/settle.js": |
725
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
726
|
|
|
|
727
|
|
|
"use strict"; |
728
|
|
|
|
729
|
|
|
|
730
|
|
|
var createError = __webpack_require__("./node_modules/axios/lib/core/createError.js"); |
731
|
|
|
|
732
|
|
|
/** |
733
|
|
|
* Resolve or reject a Promise based on response status. |
734
|
|
|
* |
735
|
|
|
* @param {Function} resolve A function that resolves the promise. |
736
|
|
|
* @param {Function} reject A function that rejects the promise. |
737
|
|
|
* @param {object} response The response. |
738
|
|
|
*/ |
739
|
|
|
module.exports = function settle(resolve, reject, response) { |
740
|
|
|
var validateStatus = response.config.validateStatus; |
741
|
|
|
// Note: status is not exposed by XDomainRequest |
742
|
|
|
if (!response.status || !validateStatus || validateStatus(response.status)) { |
743
|
|
|
resolve(response); |
744
|
|
|
} else { |
745
|
|
|
reject(createError( |
746
|
|
|
'Request failed with status code ' + response.status, |
747
|
|
|
response.config, |
748
|
|
|
null, |
749
|
|
|
response.request, |
750
|
|
|
response |
751
|
|
|
)); |
752
|
|
|
} |
753
|
|
|
}; |
754
|
|
|
|
755
|
|
|
|
756
|
|
|
/***/ }), |
757
|
|
|
|
758
|
|
|
/***/ "./node_modules/axios/lib/core/transformData.js": |
759
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
760
|
|
|
|
761
|
|
|
"use strict"; |
762
|
|
|
|
763
|
|
|
|
764
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
765
|
|
|
|
766
|
|
|
/** |
767
|
|
|
* Transform the data for a request or a response |
768
|
|
|
* |
769
|
|
|
* @param {Object|String} data The data to be transformed |
770
|
|
|
* @param {Array} headers The headers for the request or response |
771
|
|
|
* @param {Array|Function} fns A single function or Array of functions |
772
|
|
|
* @returns {*} The resulting transformed data |
773
|
|
|
*/ |
774
|
|
|
module.exports = function transformData(data, headers, fns) { |
775
|
|
|
/*eslint no-param-reassign:0*/ |
776
|
|
|
utils.forEach(fns, function transform(fn) { |
777
|
|
|
data = fn(data, headers); |
778
|
|
|
}); |
779
|
|
|
|
780
|
|
|
return data; |
781
|
|
|
}; |
782
|
|
|
|
783
|
|
|
|
784
|
|
|
/***/ }), |
785
|
|
|
|
786
|
|
|
/***/ "./node_modules/axios/lib/defaults.js": |
787
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
788
|
|
|
|
789
|
|
|
"use strict"; |
790
|
|
|
/* WEBPACK VAR INJECTION */(function(process) { |
791
|
|
|
|
792
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
793
|
|
|
var normalizeHeaderName = __webpack_require__("./node_modules/axios/lib/helpers/normalizeHeaderName.js"); |
794
|
|
|
|
795
|
|
|
var DEFAULT_CONTENT_TYPE = { |
796
|
|
|
'Content-Type': 'application/x-www-form-urlencoded' |
797
|
|
|
}; |
798
|
|
|
|
799
|
|
|
function setContentTypeIfUnset(headers, value) { |
800
|
|
|
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { |
801
|
|
|
headers['Content-Type'] = value; |
802
|
|
|
} |
803
|
|
|
} |
804
|
|
|
|
805
|
|
|
function getDefaultAdapter() { |
806
|
|
|
var adapter; |
807
|
|
|
if (typeof XMLHttpRequest !== 'undefined') { |
808
|
|
|
// For browsers use XHR adapter |
809
|
|
|
adapter = __webpack_require__("./node_modules/axios/lib/adapters/xhr.js"); |
810
|
|
|
} else if (typeof process !== 'undefined') { |
811
|
|
|
// For node use HTTP adapter |
812
|
|
|
adapter = __webpack_require__("./node_modules/axios/lib/adapters/xhr.js"); |
813
|
|
|
} |
814
|
|
|
return adapter; |
815
|
|
|
} |
816
|
|
|
|
817
|
|
|
var defaults = { |
818
|
|
|
adapter: getDefaultAdapter(), |
819
|
|
|
|
820
|
|
|
transformRequest: [function transformRequest(data, headers) { |
821
|
|
|
normalizeHeaderName(headers, 'Content-Type'); |
822
|
|
|
if (utils.isFormData(data) || |
823
|
|
|
utils.isArrayBuffer(data) || |
824
|
|
|
utils.isBuffer(data) || |
825
|
|
|
utils.isStream(data) || |
826
|
|
|
utils.isFile(data) || |
827
|
|
|
utils.isBlob(data) |
828
|
|
|
) { |
829
|
|
|
return data; |
830
|
|
|
} |
831
|
|
|
if (utils.isArrayBufferView(data)) { |
832
|
|
|
return data.buffer; |
833
|
|
|
} |
834
|
|
|
if (utils.isURLSearchParams(data)) { |
835
|
|
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); |
836
|
|
|
return data.toString(); |
837
|
|
|
} |
838
|
|
|
if (utils.isObject(data)) { |
839
|
|
|
setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); |
840
|
|
|
return JSON.stringify(data); |
841
|
|
|
} |
842
|
|
|
return data; |
843
|
|
|
}], |
844
|
|
|
|
845
|
|
|
transformResponse: [function transformResponse(data) { |
846
|
|
|
/*eslint no-param-reassign:0*/ |
847
|
|
|
if (typeof data === 'string') { |
848
|
|
|
try { |
849
|
|
|
data = JSON.parse(data); |
850
|
|
|
} catch (e) { /* Ignore */ } |
851
|
|
|
} |
852
|
|
|
return data; |
853
|
|
|
}], |
854
|
|
|
|
855
|
|
|
timeout: 0, |
856
|
|
|
|
857
|
|
|
xsrfCookieName: 'XSRF-TOKEN', |
858
|
|
|
xsrfHeaderName: 'X-XSRF-TOKEN', |
859
|
|
|
|
860
|
|
|
maxContentLength: -1, |
861
|
|
|
|
862
|
|
|
validateStatus: function validateStatus(status) { |
863
|
|
|
return status >= 200 && status < 300; |
864
|
|
|
} |
865
|
|
|
}; |
866
|
|
|
|
867
|
|
|
defaults.headers = { |
868
|
|
|
common: { |
869
|
|
|
'Accept': 'application/json, text/plain, */*' |
870
|
|
|
} |
871
|
|
|
}; |
872
|
|
|
|
873
|
|
|
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { |
874
|
|
|
defaults.headers[method] = {}; |
875
|
|
|
}); |
876
|
|
|
|
877
|
|
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { |
878
|
|
|
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); |
879
|
|
|
}); |
880
|
|
|
|
881
|
|
|
module.exports = defaults; |
882
|
|
|
|
883
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/process/browser.js"))) |
884
|
|
|
|
885
|
|
|
/***/ }), |
886
|
|
|
|
887
|
|
|
/***/ "./node_modules/axios/lib/helpers/bind.js": |
888
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
889
|
|
|
|
890
|
|
|
"use strict"; |
891
|
|
|
|
892
|
|
|
|
893
|
|
|
module.exports = function bind(fn, thisArg) { |
894
|
|
|
return function wrap() { |
895
|
|
|
var args = new Array(arguments.length); |
896
|
|
|
for (var i = 0; i < args.length; i++) { |
897
|
|
|
args[i] = arguments[i]; |
898
|
|
|
} |
899
|
|
|
return fn.apply(thisArg, args); |
900
|
|
|
}; |
901
|
|
|
}; |
902
|
|
|
|
903
|
|
|
|
904
|
|
|
/***/ }), |
905
|
|
|
|
906
|
|
|
/***/ "./node_modules/axios/lib/helpers/btoa.js": |
907
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
908
|
|
|
|
909
|
|
|
"use strict"; |
910
|
|
|
|
911
|
|
|
|
912
|
|
|
// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js |
913
|
|
|
|
914
|
|
|
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; |
915
|
|
|
|
916
|
|
|
function E() { |
917
|
|
|
this.message = 'String contains an invalid character'; |
918
|
|
|
} |
919
|
|
|
E.prototype = new Error; |
920
|
|
|
E.prototype.code = 5; |
921
|
|
|
E.prototype.name = 'InvalidCharacterError'; |
922
|
|
|
|
923
|
|
|
function btoa(input) { |
924
|
|
|
var str = String(input); |
925
|
|
|
var output = ''; |
926
|
|
|
for ( |
927
|
|
|
// initialize result and counter |
928
|
|
|
var block, charCode, idx = 0, map = chars; |
929
|
|
|
// if the next str index does not exist: |
930
|
|
|
// change the mapping table to "=" |
931
|
|
|
// check if d has no fractional digits |
932
|
|
|
str.charAt(idx | 0) || (map = '=', idx % 1); |
933
|
|
|
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 |
934
|
|
|
output += map.charAt(63 & block >> 8 - idx % 1 * 8) |
935
|
|
|
) { |
936
|
|
|
charCode = str.charCodeAt(idx += 3 / 4); |
937
|
|
|
if (charCode > 0xFF) { |
938
|
|
|
throw new E(); |
939
|
|
|
} |
940
|
|
|
block = block << 8 | charCode; |
941
|
|
|
} |
942
|
|
|
return output; |
943
|
|
|
} |
944
|
|
|
|
945
|
|
|
module.exports = btoa; |
946
|
|
|
|
947
|
|
|
|
948
|
|
|
/***/ }), |
949
|
|
|
|
950
|
|
|
/***/ "./node_modules/axios/lib/helpers/buildURL.js": |
951
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
952
|
|
|
|
953
|
|
|
"use strict"; |
954
|
|
|
|
955
|
|
|
|
956
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
957
|
|
|
|
958
|
|
|
function encode(val) { |
959
|
|
|
return encodeURIComponent(val). |
960
|
|
|
replace(/%40/gi, '@'). |
961
|
|
|
replace(/%3A/gi, ':'). |
962
|
|
|
replace(/%24/g, '$'). |
963
|
|
|
replace(/%2C/gi, ','). |
964
|
|
|
replace(/%20/g, '+'). |
965
|
|
|
replace(/%5B/gi, '['). |
966
|
|
|
replace(/%5D/gi, ']'); |
967
|
|
|
} |
968
|
|
|
|
969
|
|
|
/** |
970
|
|
|
* Build a URL by appending params to the end |
971
|
|
|
* |
972
|
|
|
* @param {string} url The base of the url (e.g., http://www.google.com) |
973
|
|
|
* @param {object} [params] The params to be appended |
974
|
|
|
* @returns {string} The formatted url |
975
|
|
|
*/ |
976
|
|
|
module.exports = function buildURL(url, params, paramsSerializer) { |
977
|
|
|
/*eslint no-param-reassign:0*/ |
978
|
|
|
if (!params) { |
979
|
|
|
return url; |
980
|
|
|
} |
981
|
|
|
|
982
|
|
|
var serializedParams; |
983
|
|
|
if (paramsSerializer) { |
984
|
|
|
serializedParams = paramsSerializer(params); |
985
|
|
|
} else if (utils.isURLSearchParams(params)) { |
986
|
|
|
serializedParams = params.toString(); |
987
|
|
|
} else { |
988
|
|
|
var parts = []; |
989
|
|
|
|
990
|
|
|
utils.forEach(params, function serialize(val, key) { |
991
|
|
|
if (val === null || typeof val === 'undefined') { |
992
|
|
|
return; |
993
|
|
|
} |
994
|
|
|
|
995
|
|
|
if (utils.isArray(val)) { |
996
|
|
|
key = key + '[]'; |
997
|
|
|
} |
998
|
|
|
|
999
|
|
|
if (!utils.isArray(val)) { |
1000
|
|
|
val = [val]; |
1001
|
|
|
} |
1002
|
|
|
|
1003
|
|
|
utils.forEach(val, function parseValue(v) { |
1004
|
|
|
if (utils.isDate(v)) { |
1005
|
|
|
v = v.toISOString(); |
1006
|
|
|
} else if (utils.isObject(v)) { |
1007
|
|
|
v = JSON.stringify(v); |
1008
|
|
|
} |
1009
|
|
|
parts.push(encode(key) + '=' + encode(v)); |
1010
|
|
|
}); |
1011
|
|
|
}); |
1012
|
|
|
|
1013
|
|
|
serializedParams = parts.join('&'); |
1014
|
|
|
} |
1015
|
|
|
|
1016
|
|
|
if (serializedParams) { |
1017
|
|
|
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; |
1018
|
|
|
} |
1019
|
|
|
|
1020
|
|
|
return url; |
1021
|
|
|
}; |
1022
|
|
|
|
1023
|
|
|
|
1024
|
|
|
/***/ }), |
1025
|
|
|
|
1026
|
|
|
/***/ "./node_modules/axios/lib/helpers/combineURLs.js": |
1027
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
1028
|
|
|
|
1029
|
|
|
"use strict"; |
1030
|
|
|
|
1031
|
|
|
|
1032
|
|
|
/** |
1033
|
|
|
* Creates a new URL by combining the specified URLs |
1034
|
|
|
* |
1035
|
|
|
* @param {string} baseURL The base URL |
1036
|
|
|
* @param {string} relativeURL The relative URL |
1037
|
|
|
* @returns {string} The combined URL |
1038
|
|
|
*/ |
1039
|
|
|
module.exports = function combineURLs(baseURL, relativeURL) { |
1040
|
|
|
return relativeURL |
1041
|
|
|
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') |
1042
|
|
|
: baseURL; |
1043
|
|
|
}; |
1044
|
|
|
|
1045
|
|
|
|
1046
|
|
|
/***/ }), |
1047
|
|
|
|
1048
|
|
|
/***/ "./node_modules/axios/lib/helpers/cookies.js": |
1049
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
1050
|
|
|
|
1051
|
|
|
"use strict"; |
1052
|
|
|
|
1053
|
|
|
|
1054
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
1055
|
|
|
|
1056
|
|
|
module.exports = ( |
1057
|
|
|
utils.isStandardBrowserEnv() ? |
1058
|
|
|
|
1059
|
|
|
// Standard browser envs support document.cookie |
1060
|
|
|
(function standardBrowserEnv() { |
1061
|
|
|
return { |
1062
|
|
|
write: function write(name, value, expires, path, domain, secure) { |
1063
|
|
|
var cookie = []; |
1064
|
|
|
cookie.push(name + '=' + encodeURIComponent(value)); |
1065
|
|
|
|
1066
|
|
|
if (utils.isNumber(expires)) { |
1067
|
|
|
cookie.push('expires=' + new Date(expires).toGMTString()); |
1068
|
|
|
} |
1069
|
|
|
|
1070
|
|
|
if (utils.isString(path)) { |
1071
|
|
|
cookie.push('path=' + path); |
1072
|
|
|
} |
1073
|
|
|
|
1074
|
|
|
if (utils.isString(domain)) { |
1075
|
|
|
cookie.push('domain=' + domain); |
1076
|
|
|
} |
1077
|
|
|
|
1078
|
|
|
if (secure === true) { |
1079
|
|
|
cookie.push('secure'); |
1080
|
|
|
} |
1081
|
|
|
|
1082
|
|
|
document.cookie = cookie.join('; '); |
1083
|
|
|
}, |
1084
|
|
|
|
1085
|
|
|
read: function read(name) { |
1086
|
|
|
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); |
1087
|
|
|
return (match ? decodeURIComponent(match[3]) : null); |
1088
|
|
|
}, |
1089
|
|
|
|
1090
|
|
|
remove: function remove(name) { |
1091
|
|
|
this.write(name, '', Date.now() - 86400000); |
1092
|
|
|
} |
1093
|
|
|
}; |
1094
|
|
|
})() : |
1095
|
|
|
|
1096
|
|
|
// Non standard browser env (web workers, react-native) lack needed support. |
1097
|
|
|
(function nonStandardBrowserEnv() { |
1098
|
|
|
return { |
1099
|
|
|
write: function write() {}, |
1100
|
|
|
read: function read() { return null; }, |
1101
|
|
|
remove: function remove() {} |
1102
|
|
|
}; |
1103
|
|
|
})() |
1104
|
|
|
); |
1105
|
|
|
|
1106
|
|
|
|
1107
|
|
|
/***/ }), |
1108
|
|
|
|
1109
|
|
|
/***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js": |
1110
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
1111
|
|
|
|
1112
|
|
|
"use strict"; |
1113
|
|
|
|
1114
|
|
|
|
1115
|
|
|
/** |
1116
|
|
|
* Determines whether the specified URL is absolute |
1117
|
|
|
* |
1118
|
|
|
* @param {string} url The URL to test |
1119
|
|
|
* @returns {boolean} True if the specified URL is absolute, otherwise false |
1120
|
|
|
*/ |
1121
|
|
|
module.exports = function isAbsoluteURL(url) { |
1122
|
|
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). |
1123
|
|
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed |
1124
|
|
|
// by any combination of letters, digits, plus, period, or hyphen. |
1125
|
|
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); |
1126
|
|
|
}; |
1127
|
|
|
|
1128
|
|
|
|
1129
|
|
|
/***/ }), |
1130
|
|
|
|
1131
|
|
|
/***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": |
1132
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
1133
|
|
|
|
1134
|
|
|
"use strict"; |
1135
|
|
|
|
1136
|
|
|
|
1137
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
1138
|
|
|
|
1139
|
|
|
module.exports = ( |
1140
|
|
|
utils.isStandardBrowserEnv() ? |
1141
|
|
|
|
1142
|
|
|
// Standard browser envs have full support of the APIs needed to test |
1143
|
|
|
// whether the request URL is of the same origin as current location. |
1144
|
|
|
(function standardBrowserEnv() { |
1145
|
|
|
var msie = /(msie|trident)/i.test(navigator.userAgent); |
1146
|
|
|
var urlParsingNode = document.createElement('a'); |
1147
|
|
|
var originURL; |
1148
|
|
|
|
1149
|
|
|
/** |
1150
|
|
|
* Parse a URL to discover it's components |
1151
|
|
|
* |
1152
|
|
|
* @param {String} url The URL to be parsed |
1153
|
|
|
* @returns {Object} |
1154
|
|
|
*/ |
1155
|
|
|
function resolveURL(url) { |
1156
|
|
|
var href = url; |
1157
|
|
|
|
1158
|
|
|
if (msie) { |
1159
|
|
|
// IE needs attribute set twice to normalize properties |
1160
|
|
|
urlParsingNode.setAttribute('href', href); |
1161
|
|
|
href = urlParsingNode.href; |
1162
|
|
|
} |
1163
|
|
|
|
1164
|
|
|
urlParsingNode.setAttribute('href', href); |
1165
|
|
|
|
1166
|
|
|
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils |
1167
|
|
|
return { |
1168
|
|
|
href: urlParsingNode.href, |
1169
|
|
|
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', |
1170
|
|
|
host: urlParsingNode.host, |
1171
|
|
|
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', |
1172
|
|
|
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', |
1173
|
|
|
hostname: urlParsingNode.hostname, |
1174
|
|
|
port: urlParsingNode.port, |
1175
|
|
|
pathname: (urlParsingNode.pathname.charAt(0) === '/') ? |
1176
|
|
|
urlParsingNode.pathname : |
1177
|
|
|
'/' + urlParsingNode.pathname |
1178
|
|
|
}; |
1179
|
|
|
} |
1180
|
|
|
|
1181
|
|
|
originURL = resolveURL(window.location.href); |
1182
|
|
|
|
1183
|
|
|
/** |
1184
|
|
|
* Determine if a URL shares the same origin as the current location |
1185
|
|
|
* |
1186
|
|
|
* @param {String} requestURL The URL to test |
1187
|
|
|
* @returns {boolean} True if URL shares the same origin, otherwise false |
1188
|
|
|
*/ |
1189
|
|
|
return function isURLSameOrigin(requestURL) { |
1190
|
|
|
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; |
1191
|
|
|
return (parsed.protocol === originURL.protocol && |
1192
|
|
|
parsed.host === originURL.host); |
1193
|
|
|
}; |
1194
|
|
|
})() : |
1195
|
|
|
|
1196
|
|
|
// Non standard browser envs (web workers, react-native) lack needed support. |
1197
|
|
|
(function nonStandardBrowserEnv() { |
1198
|
|
|
return function isURLSameOrigin() { |
1199
|
|
|
return true; |
1200
|
|
|
}; |
1201
|
|
|
})() |
1202
|
|
|
); |
1203
|
|
|
|
1204
|
|
|
|
1205
|
|
|
/***/ }), |
1206
|
|
|
|
1207
|
|
|
/***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js": |
1208
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
1209
|
|
|
|
1210
|
|
|
"use strict"; |
1211
|
|
|
|
1212
|
|
|
|
1213
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
1214
|
|
|
|
1215
|
|
|
module.exports = function normalizeHeaderName(headers, normalizedName) { |
1216
|
|
|
utils.forEach(headers, function processHeader(value, name) { |
1217
|
|
|
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { |
1218
|
|
|
headers[normalizedName] = value; |
1219
|
|
|
delete headers[name]; |
1220
|
|
|
} |
1221
|
|
|
}); |
1222
|
|
|
}; |
1223
|
|
|
|
1224
|
|
|
|
1225
|
|
|
/***/ }), |
1226
|
|
|
|
1227
|
|
|
/***/ "./node_modules/axios/lib/helpers/parseHeaders.js": |
1228
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
1229
|
|
|
|
1230
|
|
|
"use strict"; |
1231
|
|
|
|
1232
|
|
|
|
1233
|
|
|
var utils = __webpack_require__("./node_modules/axios/lib/utils.js"); |
1234
|
|
|
|
1235
|
|
|
// Headers whose duplicates are ignored by node |
1236
|
|
|
// c.f. https://nodejs.org/api/http.html#http_message_headers |
1237
|
|
|
var ignoreDuplicateOf = [ |
1238
|
|
|
'age', 'authorization', 'content-length', 'content-type', 'etag', |
1239
|
|
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', |
1240
|
|
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization', |
1241
|
|
|
'referer', 'retry-after', 'user-agent' |
1242
|
|
|
]; |
1243
|
|
|
|
1244
|
|
|
/** |
1245
|
|
|
* Parse headers into an object |
1246
|
|
|
* |
1247
|
|
|
* ``` |
1248
|
|
|
* Date: Wed, 27 Aug 2014 08:58:49 GMT |
1249
|
|
|
* Content-Type: application/json |
1250
|
|
|
* Connection: keep-alive |
1251
|
|
|
* Transfer-Encoding: chunked |
1252
|
|
|
* ``` |
1253
|
|
|
* |
1254
|
|
|
* @param {String} headers Headers needing to be parsed |
1255
|
|
|
* @returns {Object} Headers parsed into an object |
1256
|
|
|
*/ |
1257
|
|
|
module.exports = function parseHeaders(headers) { |
1258
|
|
|
var parsed = {}; |
1259
|
|
|
var key; |
1260
|
|
|
var val; |
1261
|
|
|
var i; |
1262
|
|
|
|
1263
|
|
|
if (!headers) { return parsed; } |
1264
|
|
|
|
1265
|
|
|
utils.forEach(headers.split('\n'), function parser(line) { |
1266
|
|
|
i = line.indexOf(':'); |
1267
|
|
|
key = utils.trim(line.substr(0, i)).toLowerCase(); |
1268
|
|
|
val = utils.trim(line.substr(i + 1)); |
1269
|
|
|
|
1270
|
|
|
if (key) { |
1271
|
|
|
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { |
1272
|
|
|
return; |
1273
|
|
|
} |
1274
|
|
|
if (key === 'set-cookie') { |
1275
|
|
|
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); |
1276
|
|
|
} else { |
1277
|
|
|
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; |
1278
|
|
|
} |
1279
|
|
|
} |
1280
|
|
|
}); |
1281
|
|
|
|
1282
|
|
|
return parsed; |
1283
|
|
|
}; |
1284
|
|
|
|
1285
|
|
|
|
1286
|
|
|
/***/ }), |
1287
|
|
|
|
1288
|
|
|
/***/ "./node_modules/axios/lib/helpers/spread.js": |
1289
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
1290
|
|
|
|
1291
|
|
|
"use strict"; |
1292
|
|
|
|
1293
|
|
|
|
1294
|
|
|
/** |
1295
|
|
|
* Syntactic sugar for invoking a function and expanding an array for arguments. |
1296
|
|
|
* |
1297
|
|
|
* Common use case would be to use `Function.prototype.apply`. |
1298
|
|
|
* |
1299
|
|
|
* ```js |
1300
|
|
|
* function f(x, y, z) {} |
1301
|
|
|
* var args = [1, 2, 3]; |
1302
|
|
|
* f.apply(null, args); |
1303
|
|
|
* ``` |
1304
|
|
|
* |
1305
|
|
|
* With `spread` this example can be re-written. |
1306
|
|
|
* |
1307
|
|
|
* ```js |
1308
|
|
|
* spread(function(x, y, z) {})([1, 2, 3]); |
1309
|
|
|
* ``` |
1310
|
|
|
* |
1311
|
|
|
* @param {Function} callback |
1312
|
|
|
* @returns {Function} |
1313
|
|
|
*/ |
1314
|
|
|
module.exports = function spread(callback) { |
1315
|
|
|
return function wrap(arr) { |
1316
|
|
|
return callback.apply(null, arr); |
1317
|
|
|
}; |
1318
|
|
|
}; |
1319
|
|
|
|
1320
|
|
|
|
1321
|
|
|
/***/ }), |
1322
|
|
|
|
1323
|
|
|
/***/ "./node_modules/axios/lib/utils.js": |
1324
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
1325
|
|
|
|
1326
|
|
|
"use strict"; |
1327
|
|
|
|
1328
|
|
|
|
1329
|
|
|
var bind = __webpack_require__("./node_modules/axios/lib/helpers/bind.js"); |
1330
|
|
|
var isBuffer = __webpack_require__("./node_modules/is-buffer/index.js"); |
1331
|
|
|
|
1332
|
|
|
/*global toString:true*/ |
1333
|
|
|
|
1334
|
|
|
// utils is a library of generic helper functions non-specific to axios |
1335
|
|
|
|
1336
|
|
|
var toString = Object.prototype.toString; |
1337
|
|
|
|
1338
|
|
|
/** |
1339
|
|
|
* Determine if a value is an Array |
1340
|
|
|
* |
1341
|
|
|
* @param {Object} val The value to test |
1342
|
|
|
* @returns {boolean} True if value is an Array, otherwise false |
1343
|
|
|
*/ |
1344
|
|
|
function isArray(val) { |
1345
|
|
|
return toString.call(val) === '[object Array]'; |
1346
|
|
|
} |
1347
|
|
|
|
1348
|
|
|
/** |
1349
|
|
|
* Determine if a value is an ArrayBuffer |
1350
|
|
|
* |
1351
|
|
|
* @param {Object} val The value to test |
1352
|
|
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false |
1353
|
|
|
*/ |
1354
|
|
|
function isArrayBuffer(val) { |
1355
|
|
|
return toString.call(val) === '[object ArrayBuffer]'; |
1356
|
|
|
} |
1357
|
|
|
|
1358
|
|
|
/** |
1359
|
|
|
* Determine if a value is a FormData |
1360
|
|
|
* |
1361
|
|
|
* @param {Object} val The value to test |
1362
|
|
|
* @returns {boolean} True if value is an FormData, otherwise false |
1363
|
|
|
*/ |
1364
|
|
|
function isFormData(val) { |
1365
|
|
|
return (typeof FormData !== 'undefined') && (val instanceof FormData); |
1366
|
|
|
} |
1367
|
|
|
|
1368
|
|
|
/** |
1369
|
|
|
* Determine if a value is a view on an ArrayBuffer |
1370
|
|
|
* |
1371
|
|
|
* @param {Object} val The value to test |
1372
|
|
|
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false |
1373
|
|
|
*/ |
1374
|
|
|
function isArrayBufferView(val) { |
1375
|
|
|
var result; |
1376
|
|
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { |
1377
|
|
|
result = ArrayBuffer.isView(val); |
1378
|
|
|
} else { |
1379
|
|
|
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); |
1380
|
|
|
} |
1381
|
|
|
return result; |
1382
|
|
|
} |
1383
|
|
|
|
1384
|
|
|
/** |
1385
|
|
|
* Determine if a value is a String |
1386
|
|
|
* |
1387
|
|
|
* @param {Object} val The value to test |
1388
|
|
|
* @returns {boolean} True if value is a String, otherwise false |
1389
|
|
|
*/ |
1390
|
|
|
function isString(val) { |
1391
|
|
|
return typeof val === 'string'; |
1392
|
|
|
} |
1393
|
|
|
|
1394
|
|
|
/** |
1395
|
|
|
* Determine if a value is a Number |
1396
|
|
|
* |
1397
|
|
|
* @param {Object} val The value to test |
1398
|
|
|
* @returns {boolean} True if value is a Number, otherwise false |
1399
|
|
|
*/ |
1400
|
|
|
function isNumber(val) { |
1401
|
|
|
return typeof val === 'number'; |
1402
|
|
|
} |
1403
|
|
|
|
1404
|
|
|
/** |
1405
|
|
|
* Determine if a value is undefined |
1406
|
|
|
* |
1407
|
|
|
* @param {Object} val The value to test |
1408
|
|
|
* @returns {boolean} True if the value is undefined, otherwise false |
1409
|
|
|
*/ |
1410
|
|
|
function isUndefined(val) { |
1411
|
|
|
return typeof val === 'undefined'; |
1412
|
|
|
} |
1413
|
|
|
|
1414
|
|
|
/** |
1415
|
|
|
* Determine if a value is an Object |
1416
|
|
|
* |
1417
|
|
|
* @param {Object} val The value to test |
1418
|
|
|
* @returns {boolean} True if value is an Object, otherwise false |
1419
|
|
|
*/ |
1420
|
|
|
function isObject(val) { |
1421
|
|
|
return val !== null && typeof val === 'object'; |
1422
|
|
|
} |
1423
|
|
|
|
1424
|
|
|
/** |
1425
|
|
|
* Determine if a value is a Date |
1426
|
|
|
* |
1427
|
|
|
* @param {Object} val The value to test |
1428
|
|
|
* @returns {boolean} True if value is a Date, otherwise false |
1429
|
|
|
*/ |
1430
|
|
|
function isDate(val) { |
1431
|
|
|
return toString.call(val) === '[object Date]'; |
1432
|
|
|
} |
1433
|
|
|
|
1434
|
|
|
/** |
1435
|
|
|
* Determine if a value is a File |
1436
|
|
|
* |
1437
|
|
|
* @param {Object} val The value to test |
1438
|
|
|
* @returns {boolean} True if value is a File, otherwise false |
1439
|
|
|
*/ |
1440
|
|
|
function isFile(val) { |
1441
|
|
|
return toString.call(val) === '[object File]'; |
1442
|
|
|
} |
1443
|
|
|
|
1444
|
|
|
/** |
1445
|
|
|
* Determine if a value is a Blob |
1446
|
|
|
* |
1447
|
|
|
* @param {Object} val The value to test |
1448
|
|
|
* @returns {boolean} True if value is a Blob, otherwise false |
1449
|
|
|
*/ |
1450
|
|
|
function isBlob(val) { |
1451
|
|
|
return toString.call(val) === '[object Blob]'; |
1452
|
|
|
} |
1453
|
|
|
|
1454
|
|
|
/** |
1455
|
|
|
* Determine if a value is a Function |
1456
|
|
|
* |
1457
|
|
|
* @param {Object} val The value to test |
1458
|
|
|
* @returns {boolean} True if value is a Function, otherwise false |
1459
|
|
|
*/ |
1460
|
|
|
function isFunction(val) { |
1461
|
|
|
return toString.call(val) === '[object Function]'; |
1462
|
|
|
} |
1463
|
|
|
|
1464
|
|
|
/** |
1465
|
|
|
* Determine if a value is a Stream |
1466
|
|
|
* |
1467
|
|
|
* @param {Object} val The value to test |
1468
|
|
|
* @returns {boolean} True if value is a Stream, otherwise false |
1469
|
|
|
*/ |
1470
|
|
|
function isStream(val) { |
1471
|
|
|
return isObject(val) && isFunction(val.pipe); |
1472
|
|
|
} |
1473
|
|
|
|
1474
|
|
|
/** |
1475
|
|
|
* Determine if a value is a URLSearchParams object |
1476
|
|
|
* |
1477
|
|
|
* @param {Object} val The value to test |
1478
|
|
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false |
1479
|
|
|
*/ |
1480
|
|
|
function isURLSearchParams(val) { |
1481
|
|
|
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; |
1482
|
|
|
} |
1483
|
|
|
|
1484
|
|
|
/** |
1485
|
|
|
* Trim excess whitespace off the beginning and end of a string |
1486
|
|
|
* |
1487
|
|
|
* @param {String} str The String to trim |
1488
|
|
|
* @returns {String} The String freed of excess whitespace |
1489
|
|
|
*/ |
1490
|
|
|
function trim(str) { |
1491
|
|
|
return str.replace(/^\s*/, '').replace(/\s*$/, ''); |
1492
|
|
|
} |
1493
|
|
|
|
1494
|
|
|
/** |
1495
|
|
|
* Determine if we're running in a standard browser environment |
1496
|
|
|
* |
1497
|
|
|
* This allows axios to run in a web worker, and react-native. |
1498
|
|
|
* Both environments support XMLHttpRequest, but not fully standard globals. |
1499
|
|
|
* |
1500
|
|
|
* web workers: |
1501
|
|
|
* typeof window -> undefined |
1502
|
|
|
* typeof document -> undefined |
1503
|
|
|
* |
1504
|
|
|
* react-native: |
1505
|
|
|
* navigator.product -> 'ReactNative' |
1506
|
|
|
*/ |
1507
|
|
|
function isStandardBrowserEnv() { |
1508
|
|
|
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { |
1509
|
|
|
return false; |
1510
|
|
|
} |
1511
|
|
|
return ( |
1512
|
|
|
typeof window !== 'undefined' && |
1513
|
|
|
typeof document !== 'undefined' |
1514
|
|
|
); |
1515
|
|
|
} |
1516
|
|
|
|
1517
|
|
|
/** |
1518
|
|
|
* Iterate over an Array or an Object invoking a function for each item. |
1519
|
|
|
* |
1520
|
|
|
* If `obj` is an Array callback will be called passing |
1521
|
|
|
* the value, index, and complete array for each item. |
1522
|
|
|
* |
1523
|
|
|
* If 'obj' is an Object callback will be called passing |
1524
|
|
|
* the value, key, and complete object for each property. |
1525
|
|
|
* |
1526
|
|
|
* @param {Object|Array} obj The object to iterate |
1527
|
|
|
* @param {Function} fn The callback to invoke for each item |
1528
|
|
|
*/ |
1529
|
|
|
function forEach(obj, fn) { |
1530
|
|
|
// Don't bother if no value provided |
1531
|
|
|
if (obj === null || typeof obj === 'undefined') { |
1532
|
|
|
return; |
1533
|
|
|
} |
1534
|
|
|
|
1535
|
|
|
// Force an array if not already something iterable |
1536
|
|
|
if (typeof obj !== 'object') { |
1537
|
|
|
/*eslint no-param-reassign:0*/ |
1538
|
|
|
obj = [obj]; |
1539
|
|
|
} |
1540
|
|
|
|
1541
|
|
|
if (isArray(obj)) { |
1542
|
|
|
// Iterate over array values |
1543
|
|
|
for (var i = 0, l = obj.length; i < l; i++) { |
1544
|
|
|
fn.call(null, obj[i], i, obj); |
1545
|
|
|
} |
1546
|
|
|
} else { |
1547
|
|
|
// Iterate over object keys |
1548
|
|
|
for (var key in obj) { |
1549
|
|
|
if (Object.prototype.hasOwnProperty.call(obj, key)) { |
1550
|
|
|
fn.call(null, obj[key], key, obj); |
1551
|
|
|
} |
1552
|
|
|
} |
1553
|
|
|
} |
1554
|
|
|
} |
1555
|
|
|
|
1556
|
|
|
/** |
1557
|
|
|
* Accepts varargs expecting each argument to be an object, then |
1558
|
|
|
* immutably merges the properties of each object and returns result. |
1559
|
|
|
* |
1560
|
|
|
* When multiple objects contain the same key the later object in |
1561
|
|
|
* the arguments list will take precedence. |
1562
|
|
|
* |
1563
|
|
|
* Example: |
1564
|
|
|
* |
1565
|
|
|
* ```js |
1566
|
|
|
* var result = merge({foo: 123}, {foo: 456}); |
1567
|
|
|
* console.log(result.foo); // outputs 456 |
1568
|
|
|
* ``` |
1569
|
|
|
* |
1570
|
|
|
* @param {Object} obj1 Object to merge |
1571
|
|
|
* @returns {Object} Result of all merge properties |
1572
|
|
|
*/ |
1573
|
|
|
function merge(/* obj1, obj2, obj3, ... */) { |
1574
|
|
|
var result = {}; |
1575
|
|
|
function assignValue(val, key) { |
1576
|
|
|
if (typeof result[key] === 'object' && typeof val === 'object') { |
1577
|
|
|
result[key] = merge(result[key], val); |
1578
|
|
|
} else { |
1579
|
|
|
result[key] = val; |
1580
|
|
|
} |
1581
|
|
|
} |
1582
|
|
|
|
1583
|
|
|
for (var i = 0, l = arguments.length; i < l; i++) { |
1584
|
|
|
forEach(arguments[i], assignValue); |
1585
|
|
|
} |
1586
|
|
|
return result; |
1587
|
|
|
} |
1588
|
|
|
|
1589
|
|
|
/** |
1590
|
|
|
* Extends object a by mutably adding to it the properties of object b. |
1591
|
|
|
* |
1592
|
|
|
* @param {Object} a The object to be extended |
1593
|
|
|
* @param {Object} b The object to copy properties from |
1594
|
|
|
* @param {Object} thisArg The object to bind function to |
1595
|
|
|
* @return {Object} The resulting value of object a |
1596
|
|
|
*/ |
1597
|
|
|
function extend(a, b, thisArg) { |
1598
|
|
|
forEach(b, function assignValue(val, key) { |
1599
|
|
|
if (thisArg && typeof val === 'function') { |
1600
|
|
|
a[key] = bind(val, thisArg); |
1601
|
|
|
} else { |
1602
|
|
|
a[key] = val; |
1603
|
|
|
} |
1604
|
|
|
}); |
1605
|
|
|
return a; |
1606
|
|
|
} |
1607
|
|
|
|
1608
|
|
|
module.exports = { |
1609
|
|
|
isArray: isArray, |
1610
|
|
|
isArrayBuffer: isArrayBuffer, |
1611
|
|
|
isBuffer: isBuffer, |
1612
|
|
|
isFormData: isFormData, |
1613
|
|
|
isArrayBufferView: isArrayBufferView, |
1614
|
|
|
isString: isString, |
1615
|
|
|
isNumber: isNumber, |
1616
|
|
|
isObject: isObject, |
1617
|
|
|
isUndefined: isUndefined, |
1618
|
|
|
isDate: isDate, |
1619
|
|
|
isFile: isFile, |
1620
|
|
|
isBlob: isBlob, |
1621
|
|
|
isFunction: isFunction, |
1622
|
|
|
isStream: isStream, |
1623
|
|
|
isURLSearchParams: isURLSearchParams, |
1624
|
|
|
isStandardBrowserEnv: isStandardBrowserEnv, |
1625
|
|
|
forEach: forEach, |
1626
|
|
|
merge: merge, |
1627
|
|
|
extend: extend, |
1628
|
|
|
trim: trim |
1629
|
|
|
}; |
1630
|
|
|
|
1631
|
|
|
|
1632
|
|
|
/***/ }), |
1633
|
|
|
|
1634
|
|
|
/***/ "./node_modules/es6-promise/dist/es6-promise.js": |
1635
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
1636
|
|
|
|
1637
|
|
|
/* WEBPACK VAR INJECTION */(function(process, global) {/*! |
1638
|
|
|
* @overview es6-promise - a tiny implementation of Promises/A+. |
1639
|
|
|
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) |
1640
|
|
|
* @license Licensed under MIT license |
1641
|
|
|
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE |
1642
|
|
|
* @version v4.2.5+7f2b526d |
1643
|
|
|
*/ |
1644
|
|
|
|
1645
|
|
|
(function (global, factory) { |
1646
|
|
|
true ? module.exports = factory() : |
1647
|
|
|
typeof define === 'function' && define.amd ? define(factory) : |
1648
|
|
|
(global.ES6Promise = factory()); |
1649
|
|
|
}(this, (function () { 'use strict'; |
1650
|
|
|
|
1651
|
|
|
function objectOrFunction(x) { |
1652
|
|
|
var type = typeof x; |
1653
|
|
|
return x !== null && (type === 'object' || type === 'function'); |
1654
|
|
|
} |
1655
|
|
|
|
1656
|
|
|
function isFunction(x) { |
1657
|
|
|
return typeof x === 'function'; |
1658
|
|
|
} |
1659
|
|
|
|
1660
|
|
|
|
1661
|
|
|
|
1662
|
|
|
var _isArray = void 0; |
1663
|
|
|
if (Array.isArray) { |
1664
|
|
|
_isArray = Array.isArray; |
1665
|
|
|
} else { |
1666
|
|
|
_isArray = function (x) { |
1667
|
|
|
return Object.prototype.toString.call(x) === '[object Array]'; |
1668
|
|
|
}; |
1669
|
|
|
} |
1670
|
|
|
|
1671
|
|
|
var isArray = _isArray; |
1672
|
|
|
|
1673
|
|
|
var len = 0; |
1674
|
|
|
var vertxNext = void 0; |
1675
|
|
|
var customSchedulerFn = void 0; |
1676
|
|
|
|
1677
|
|
|
var asap = function asap(callback, arg) { |
1678
|
|
|
queue[len] = callback; |
1679
|
|
|
queue[len + 1] = arg; |
1680
|
|
|
len += 2; |
1681
|
|
|
if (len === 2) { |
1682
|
|
|
// If len is 2, that means that we need to schedule an async flush. |
1683
|
|
|
// If additional callbacks are queued before the queue is flushed, they |
1684
|
|
|
// will be processed by this flush that we are scheduling. |
1685
|
|
|
if (customSchedulerFn) { |
1686
|
|
|
customSchedulerFn(flush); |
1687
|
|
|
} else { |
1688
|
|
|
scheduleFlush(); |
1689
|
|
|
} |
1690
|
|
|
} |
1691
|
|
|
}; |
1692
|
|
|
|
1693
|
|
|
function setScheduler(scheduleFn) { |
1694
|
|
|
customSchedulerFn = scheduleFn; |
1695
|
|
|
} |
1696
|
|
|
|
1697
|
|
|
function setAsap(asapFn) { |
1698
|
|
|
asap = asapFn; |
1699
|
|
|
} |
1700
|
|
|
|
1701
|
|
|
var browserWindow = typeof window !== 'undefined' ? window : undefined; |
1702
|
|
|
var browserGlobal = browserWindow || {}; |
1703
|
|
|
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; |
1704
|
|
|
var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; |
1705
|
|
|
|
1706
|
|
|
// test for web worker but not in IE10 |
1707
|
|
|
var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; |
1708
|
|
|
|
1709
|
|
|
// node |
1710
|
|
|
function useNextTick() { |
1711
|
|
|
// node version 0.10.x displays a deprecation warning when nextTick is used recursively |
1712
|
|
|
// see https://github.com/cujojs/when/issues/410 for details |
1713
|
|
|
return function () { |
1714
|
|
|
return process.nextTick(flush); |
1715
|
|
|
}; |
1716
|
|
|
} |
1717
|
|
|
|
1718
|
|
|
// vertx |
1719
|
|
|
function useVertxTimer() { |
1720
|
|
|
if (typeof vertxNext !== 'undefined') { |
1721
|
|
|
return function () { |
1722
|
|
|
vertxNext(flush); |
1723
|
|
|
}; |
1724
|
|
|
} |
1725
|
|
|
|
1726
|
|
|
return useSetTimeout(); |
1727
|
|
|
} |
1728
|
|
|
|
1729
|
|
|
function useMutationObserver() { |
1730
|
|
|
var iterations = 0; |
1731
|
|
|
var observer = new BrowserMutationObserver(flush); |
1732
|
|
|
var node = document.createTextNode(''); |
1733
|
|
|
observer.observe(node, { characterData: true }); |
1734
|
|
|
|
1735
|
|
|
return function () { |
1736
|
|
|
node.data = iterations = ++iterations % 2; |
1737
|
|
|
}; |
1738
|
|
|
} |
1739
|
|
|
|
1740
|
|
|
// web worker |
1741
|
|
|
function useMessageChannel() { |
1742
|
|
|
var channel = new MessageChannel(); |
1743
|
|
|
channel.port1.onmessage = flush; |
1744
|
|
|
return function () { |
1745
|
|
|
return channel.port2.postMessage(0); |
1746
|
|
|
}; |
1747
|
|
|
} |
1748
|
|
|
|
1749
|
|
|
function useSetTimeout() { |
1750
|
|
|
// Store setTimeout reference so es6-promise will be unaffected by |
1751
|
|
|
// other code modifying setTimeout (like sinon.useFakeTimers()) |
1752
|
|
|
var globalSetTimeout = setTimeout; |
1753
|
|
|
return function () { |
1754
|
|
|
return globalSetTimeout(flush, 1); |
1755
|
|
|
}; |
1756
|
|
|
} |
1757
|
|
|
|
1758
|
|
|
var queue = new Array(1000); |
1759
|
|
|
function flush() { |
1760
|
|
|
for (var i = 0; i < len; i += 2) { |
1761
|
|
|
var callback = queue[i]; |
1762
|
|
|
var arg = queue[i + 1]; |
1763
|
|
|
|
1764
|
|
|
callback(arg); |
1765
|
|
|
|
1766
|
|
|
queue[i] = undefined; |
1767
|
|
|
queue[i + 1] = undefined; |
1768
|
|
|
} |
1769
|
|
|
|
1770
|
|
|
len = 0; |
1771
|
|
|
} |
1772
|
|
|
|
1773
|
|
|
function attemptVertx() { |
1774
|
|
|
try { |
1775
|
|
|
var vertx = Function('return this')().require('vertx'); |
1776
|
|
|
vertxNext = vertx.runOnLoop || vertx.runOnContext; |
1777
|
|
|
return useVertxTimer(); |
1778
|
|
|
} catch (e) { |
1779
|
|
|
return useSetTimeout(); |
1780
|
|
|
} |
1781
|
|
|
} |
1782
|
|
|
|
1783
|
|
|
var scheduleFlush = void 0; |
1784
|
|
|
// Decide what async method to use to triggering processing of queued callbacks: |
1785
|
|
|
if (isNode) { |
1786
|
|
|
scheduleFlush = useNextTick(); |
1787
|
|
|
} else if (BrowserMutationObserver) { |
1788
|
|
|
scheduleFlush = useMutationObserver(); |
1789
|
|
|
} else if (isWorker) { |
1790
|
|
|
scheduleFlush = useMessageChannel(); |
1791
|
|
|
} else if (browserWindow === undefined && "function" === 'function') { |
1792
|
|
|
scheduleFlush = attemptVertx(); |
1793
|
|
|
} else { |
1794
|
|
|
scheduleFlush = useSetTimeout(); |
1795
|
|
|
} |
1796
|
|
|
|
1797
|
|
|
function then(onFulfillment, onRejection) { |
1798
|
|
|
var parent = this; |
1799
|
|
|
|
1800
|
|
|
var child = new this.constructor(noop); |
1801
|
|
|
|
1802
|
|
|
if (child[PROMISE_ID] === undefined) { |
1803
|
|
|
makePromise(child); |
1804
|
|
|
} |
1805
|
|
|
|
1806
|
|
|
var _state = parent._state; |
1807
|
|
|
|
1808
|
|
|
|
1809
|
|
|
if (_state) { |
1810
|
|
|
var callback = arguments[_state - 1]; |
1811
|
|
|
asap(function () { |
1812
|
|
|
return invokeCallback(_state, child, callback, parent._result); |
1813
|
|
|
}); |
1814
|
|
|
} else { |
1815
|
|
|
subscribe(parent, child, onFulfillment, onRejection); |
1816
|
|
|
} |
1817
|
|
|
|
1818
|
|
|
return child; |
1819
|
|
|
} |
1820
|
|
|
|
1821
|
|
|
/** |
1822
|
|
|
`Promise.resolve` returns a promise that will become resolved with the |
1823
|
|
|
passed `value`. It is shorthand for the following: |
1824
|
|
|
|
1825
|
|
|
```javascript |
1826
|
|
|
let promise = new Promise(function(resolve, reject){ |
1827
|
|
|
resolve(1); |
1828
|
|
|
}); |
1829
|
|
|
|
1830
|
|
|
promise.then(function(value){ |
1831
|
|
|
// value === 1 |
1832
|
|
|
}); |
1833
|
|
|
``` |
1834
|
|
|
|
1835
|
|
|
Instead of writing the above, your code now simply becomes the following: |
1836
|
|
|
|
1837
|
|
|
```javascript |
1838
|
|
|
let promise = Promise.resolve(1); |
1839
|
|
|
|
1840
|
|
|
promise.then(function(value){ |
1841
|
|
|
// value === 1 |
1842
|
|
|
}); |
1843
|
|
|
``` |
1844
|
|
|
|
1845
|
|
|
@method resolve |
1846
|
|
|
@static |
1847
|
|
|
@param {Any} value value that the returned promise will be resolved with |
1848
|
|
|
Useful for tooling. |
1849
|
|
|
@return {Promise} a promise that will become fulfilled with the given |
1850
|
|
|
`value` |
1851
|
|
|
*/ |
1852
|
|
|
function resolve$1(object) { |
1853
|
|
|
/*jshint validthis:true */ |
1854
|
|
|
var Constructor = this; |
1855
|
|
|
|
1856
|
|
|
if (object && typeof object === 'object' && object.constructor === Constructor) { |
1857
|
|
|
return object; |
1858
|
|
|
} |
1859
|
|
|
|
1860
|
|
|
var promise = new Constructor(noop); |
1861
|
|
|
resolve(promise, object); |
1862
|
|
|
return promise; |
1863
|
|
|
} |
1864
|
|
|
|
1865
|
|
|
var PROMISE_ID = Math.random().toString(36).substring(2); |
1866
|
|
|
|
1867
|
|
|
function noop() {} |
1868
|
|
|
|
1869
|
|
|
var PENDING = void 0; |
1870
|
|
|
var FULFILLED = 1; |
1871
|
|
|
var REJECTED = 2; |
1872
|
|
|
|
1873
|
|
|
var TRY_CATCH_ERROR = { error: null }; |
1874
|
|
|
|
1875
|
|
|
function selfFulfillment() { |
1876
|
|
|
return new TypeError("You cannot resolve a promise with itself"); |
1877
|
|
|
} |
1878
|
|
|
|
1879
|
|
|
function cannotReturnOwn() { |
1880
|
|
|
return new TypeError('A promises callback cannot return that same promise.'); |
1881
|
|
|
} |
1882
|
|
|
|
1883
|
|
|
function getThen(promise) { |
1884
|
|
|
try { |
1885
|
|
|
return promise.then; |
1886
|
|
|
} catch (error) { |
1887
|
|
|
TRY_CATCH_ERROR.error = error; |
1888
|
|
|
return TRY_CATCH_ERROR; |
1889
|
|
|
} |
1890
|
|
|
} |
1891
|
|
|
|
1892
|
|
|
function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { |
1893
|
|
|
try { |
1894
|
|
|
then$$1.call(value, fulfillmentHandler, rejectionHandler); |
1895
|
|
|
} catch (e) { |
1896
|
|
|
return e; |
1897
|
|
|
} |
1898
|
|
|
} |
1899
|
|
|
|
1900
|
|
|
function handleForeignThenable(promise, thenable, then$$1) { |
1901
|
|
|
asap(function (promise) { |
1902
|
|
|
var sealed = false; |
1903
|
|
|
var error = tryThen(then$$1, thenable, function (value) { |
1904
|
|
|
if (sealed) { |
1905
|
|
|
return; |
1906
|
|
|
} |
1907
|
|
|
sealed = true; |
1908
|
|
|
if (thenable !== value) { |
1909
|
|
|
resolve(promise, value); |
1910
|
|
|
} else { |
1911
|
|
|
fulfill(promise, value); |
1912
|
|
|
} |
1913
|
|
|
}, function (reason) { |
1914
|
|
|
if (sealed) { |
1915
|
|
|
return; |
1916
|
|
|
} |
1917
|
|
|
sealed = true; |
1918
|
|
|
|
1919
|
|
|
reject(promise, reason); |
1920
|
|
|
}, 'Settle: ' + (promise._label || ' unknown promise')); |
1921
|
|
|
|
1922
|
|
|
if (!sealed && error) { |
1923
|
|
|
sealed = true; |
1924
|
|
|
reject(promise, error); |
1925
|
|
|
} |
1926
|
|
|
}, promise); |
1927
|
|
|
} |
1928
|
|
|
|
1929
|
|
|
function handleOwnThenable(promise, thenable) { |
1930
|
|
|
if (thenable._state === FULFILLED) { |
1931
|
|
|
fulfill(promise, thenable._result); |
1932
|
|
|
} else if (thenable._state === REJECTED) { |
1933
|
|
|
reject(promise, thenable._result); |
1934
|
|
|
} else { |
1935
|
|
|
subscribe(thenable, undefined, function (value) { |
1936
|
|
|
return resolve(promise, value); |
1937
|
|
|
}, function (reason) { |
1938
|
|
|
return reject(promise, reason); |
1939
|
|
|
}); |
1940
|
|
|
} |
1941
|
|
|
} |
1942
|
|
|
|
1943
|
|
|
function handleMaybeThenable(promise, maybeThenable, then$$1) { |
1944
|
|
|
if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { |
1945
|
|
|
handleOwnThenable(promise, maybeThenable); |
1946
|
|
|
} else { |
1947
|
|
|
if (then$$1 === TRY_CATCH_ERROR) { |
1948
|
|
|
reject(promise, TRY_CATCH_ERROR.error); |
1949
|
|
|
TRY_CATCH_ERROR.error = null; |
1950
|
|
|
} else if (then$$1 === undefined) { |
1951
|
|
|
fulfill(promise, maybeThenable); |
1952
|
|
|
} else if (isFunction(then$$1)) { |
1953
|
|
|
handleForeignThenable(promise, maybeThenable, then$$1); |
1954
|
|
|
} else { |
1955
|
|
|
fulfill(promise, maybeThenable); |
1956
|
|
|
} |
1957
|
|
|
} |
1958
|
|
|
} |
1959
|
|
|
|
1960
|
|
|
function resolve(promise, value) { |
1961
|
|
|
if (promise === value) { |
1962
|
|
|
reject(promise, selfFulfillment()); |
1963
|
|
|
} else if (objectOrFunction(value)) { |
1964
|
|
|
handleMaybeThenable(promise, value, getThen(value)); |
1965
|
|
|
} else { |
1966
|
|
|
fulfill(promise, value); |
1967
|
|
|
} |
1968
|
|
|
} |
1969
|
|
|
|
1970
|
|
|
function publishRejection(promise) { |
1971
|
|
|
if (promise._onerror) { |
1972
|
|
|
promise._onerror(promise._result); |
1973
|
|
|
} |
1974
|
|
|
|
1975
|
|
|
publish(promise); |
1976
|
|
|
} |
1977
|
|
|
|
1978
|
|
|
function fulfill(promise, value) { |
1979
|
|
|
if (promise._state !== PENDING) { |
1980
|
|
|
return; |
1981
|
|
|
} |
1982
|
|
|
|
1983
|
|
|
promise._result = value; |
1984
|
|
|
promise._state = FULFILLED; |
1985
|
|
|
|
1986
|
|
|
if (promise._subscribers.length !== 0) { |
1987
|
|
|
asap(publish, promise); |
1988
|
|
|
} |
1989
|
|
|
} |
1990
|
|
|
|
1991
|
|
|
function reject(promise, reason) { |
1992
|
|
|
if (promise._state !== PENDING) { |
1993
|
|
|
return; |
1994
|
|
|
} |
1995
|
|
|
promise._state = REJECTED; |
1996
|
|
|
promise._result = reason; |
1997
|
|
|
|
1998
|
|
|
asap(publishRejection, promise); |
1999
|
|
|
} |
2000
|
|
|
|
2001
|
|
|
function subscribe(parent, child, onFulfillment, onRejection) { |
2002
|
|
|
var _subscribers = parent._subscribers; |
2003
|
|
|
var length = _subscribers.length; |
2004
|
|
|
|
2005
|
|
|
|
2006
|
|
|
parent._onerror = null; |
2007
|
|
|
|
2008
|
|
|
_subscribers[length] = child; |
2009
|
|
|
_subscribers[length + FULFILLED] = onFulfillment; |
2010
|
|
|
_subscribers[length + REJECTED] = onRejection; |
2011
|
|
|
|
2012
|
|
|
if (length === 0 && parent._state) { |
2013
|
|
|
asap(publish, parent); |
2014
|
|
|
} |
2015
|
|
|
} |
2016
|
|
|
|
2017
|
|
|
function publish(promise) { |
2018
|
|
|
var subscribers = promise._subscribers; |
2019
|
|
|
var settled = promise._state; |
2020
|
|
|
|
2021
|
|
|
if (subscribers.length === 0) { |
2022
|
|
|
return; |
2023
|
|
|
} |
2024
|
|
|
|
2025
|
|
|
var child = void 0, |
2026
|
|
|
callback = void 0, |
2027
|
|
|
detail = promise._result; |
2028
|
|
|
|
2029
|
|
|
for (var i = 0; i < subscribers.length; i += 3) { |
2030
|
|
|
child = subscribers[i]; |
2031
|
|
|
callback = subscribers[i + settled]; |
2032
|
|
|
|
2033
|
|
|
if (child) { |
2034
|
|
|
invokeCallback(settled, child, callback, detail); |
2035
|
|
|
} else { |
2036
|
|
|
callback(detail); |
2037
|
|
|
} |
2038
|
|
|
} |
2039
|
|
|
|
2040
|
|
|
promise._subscribers.length = 0; |
2041
|
|
|
} |
2042
|
|
|
|
2043
|
|
|
function tryCatch(callback, detail) { |
2044
|
|
|
try { |
2045
|
|
|
return callback(detail); |
2046
|
|
|
} catch (e) { |
2047
|
|
|
TRY_CATCH_ERROR.error = e; |
2048
|
|
|
return TRY_CATCH_ERROR; |
2049
|
|
|
} |
2050
|
|
|
} |
2051
|
|
|
|
2052
|
|
|
function invokeCallback(settled, promise, callback, detail) { |
2053
|
|
|
var hasCallback = isFunction(callback), |
2054
|
|
|
value = void 0, |
2055
|
|
|
error = void 0, |
2056
|
|
|
succeeded = void 0, |
2057
|
|
|
failed = void 0; |
2058
|
|
|
|
2059
|
|
|
if (hasCallback) { |
2060
|
|
|
value = tryCatch(callback, detail); |
2061
|
|
|
|
2062
|
|
|
if (value === TRY_CATCH_ERROR) { |
2063
|
|
|
failed = true; |
2064
|
|
|
error = value.error; |
2065
|
|
|
value.error = null; |
2066
|
|
|
} else { |
2067
|
|
|
succeeded = true; |
2068
|
|
|
} |
2069
|
|
|
|
2070
|
|
|
if (promise === value) { |
2071
|
|
|
reject(promise, cannotReturnOwn()); |
2072
|
|
|
return; |
2073
|
|
|
} |
2074
|
|
|
} else { |
2075
|
|
|
value = detail; |
2076
|
|
|
succeeded = true; |
2077
|
|
|
} |
2078
|
|
|
|
2079
|
|
|
if (promise._state !== PENDING) { |
2080
|
|
|
// noop |
2081
|
|
|
} else if (hasCallback && succeeded) { |
2082
|
|
|
resolve(promise, value); |
2083
|
|
|
} else if (failed) { |
2084
|
|
|
reject(promise, error); |
2085
|
|
|
} else if (settled === FULFILLED) { |
2086
|
|
|
fulfill(promise, value); |
2087
|
|
|
} else if (settled === REJECTED) { |
2088
|
|
|
reject(promise, value); |
2089
|
|
|
} |
2090
|
|
|
} |
2091
|
|
|
|
2092
|
|
|
function initializePromise(promise, resolver) { |
2093
|
|
|
try { |
2094
|
|
|
resolver(function resolvePromise(value) { |
2095
|
|
|
resolve(promise, value); |
2096
|
|
|
}, function rejectPromise(reason) { |
2097
|
|
|
reject(promise, reason); |
2098
|
|
|
}); |
2099
|
|
|
} catch (e) { |
2100
|
|
|
reject(promise, e); |
2101
|
|
|
} |
2102
|
|
|
} |
2103
|
|
|
|
2104
|
|
|
var id = 0; |
2105
|
|
|
function nextId() { |
2106
|
|
|
return id++; |
2107
|
|
|
} |
2108
|
|
|
|
2109
|
|
|
function makePromise(promise) { |
2110
|
|
|
promise[PROMISE_ID] = id++; |
2111
|
|
|
promise._state = undefined; |
2112
|
|
|
promise._result = undefined; |
2113
|
|
|
promise._subscribers = []; |
2114
|
|
|
} |
2115
|
|
|
|
2116
|
|
|
function validationError() { |
2117
|
|
|
return new Error('Array Methods must be provided an Array'); |
2118
|
|
|
} |
2119
|
|
|
|
2120
|
|
|
var Enumerator = function () { |
2121
|
|
|
function Enumerator(Constructor, input) { |
2122
|
|
|
this._instanceConstructor = Constructor; |
2123
|
|
|
this.promise = new Constructor(noop); |
2124
|
|
|
|
2125
|
|
|
if (!this.promise[PROMISE_ID]) { |
2126
|
|
|
makePromise(this.promise); |
2127
|
|
|
} |
2128
|
|
|
|
2129
|
|
|
if (isArray(input)) { |
2130
|
|
|
this.length = input.length; |
2131
|
|
|
this._remaining = input.length; |
2132
|
|
|
|
2133
|
|
|
this._result = new Array(this.length); |
2134
|
|
|
|
2135
|
|
|
if (this.length === 0) { |
2136
|
|
|
fulfill(this.promise, this._result); |
2137
|
|
|
} else { |
2138
|
|
|
this.length = this.length || 0; |
2139
|
|
|
this._enumerate(input); |
2140
|
|
|
if (this._remaining === 0) { |
2141
|
|
|
fulfill(this.promise, this._result); |
2142
|
|
|
} |
2143
|
|
|
} |
2144
|
|
|
} else { |
2145
|
|
|
reject(this.promise, validationError()); |
2146
|
|
|
} |
2147
|
|
|
} |
2148
|
|
|
|
2149
|
|
|
Enumerator.prototype._enumerate = function _enumerate(input) { |
2150
|
|
|
for (var i = 0; this._state === PENDING && i < input.length; i++) { |
2151
|
|
|
this._eachEntry(input[i], i); |
2152
|
|
|
} |
2153
|
|
|
}; |
2154
|
|
|
|
2155
|
|
|
Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { |
2156
|
|
|
var c = this._instanceConstructor; |
2157
|
|
|
var resolve$$1 = c.resolve; |
2158
|
|
|
|
2159
|
|
|
|
2160
|
|
|
if (resolve$$1 === resolve$1) { |
2161
|
|
|
var _then = getThen(entry); |
2162
|
|
|
|
2163
|
|
|
if (_then === then && entry._state !== PENDING) { |
2164
|
|
|
this._settledAt(entry._state, i, entry._result); |
2165
|
|
|
} else if (typeof _then !== 'function') { |
2166
|
|
|
this._remaining--; |
2167
|
|
|
this._result[i] = entry; |
2168
|
|
|
} else if (c === Promise$1) { |
2169
|
|
|
var promise = new c(noop); |
2170
|
|
|
handleMaybeThenable(promise, entry, _then); |
2171
|
|
|
this._willSettleAt(promise, i); |
2172
|
|
|
} else { |
2173
|
|
|
this._willSettleAt(new c(function (resolve$$1) { |
2174
|
|
|
return resolve$$1(entry); |
2175
|
|
|
}), i); |
2176
|
|
|
} |
2177
|
|
|
} else { |
2178
|
|
|
this._willSettleAt(resolve$$1(entry), i); |
2179
|
|
|
} |
2180
|
|
|
}; |
2181
|
|
|
|
2182
|
|
|
Enumerator.prototype._settledAt = function _settledAt(state, i, value) { |
2183
|
|
|
var promise = this.promise; |
2184
|
|
|
|
2185
|
|
|
|
2186
|
|
|
if (promise._state === PENDING) { |
2187
|
|
|
this._remaining--; |
2188
|
|
|
|
2189
|
|
|
if (state === REJECTED) { |
2190
|
|
|
reject(promise, value); |
2191
|
|
|
} else { |
2192
|
|
|
this._result[i] = value; |
2193
|
|
|
} |
2194
|
|
|
} |
2195
|
|
|
|
2196
|
|
|
if (this._remaining === 0) { |
2197
|
|
|
fulfill(promise, this._result); |
2198
|
|
|
} |
2199
|
|
|
}; |
2200
|
|
|
|
2201
|
|
|
Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { |
2202
|
|
|
var enumerator = this; |
2203
|
|
|
|
2204
|
|
|
subscribe(promise, undefined, function (value) { |
2205
|
|
|
return enumerator._settledAt(FULFILLED, i, value); |
2206
|
|
|
}, function (reason) { |
2207
|
|
|
return enumerator._settledAt(REJECTED, i, reason); |
2208
|
|
|
}); |
2209
|
|
|
}; |
2210
|
|
|
|
2211
|
|
|
return Enumerator; |
2212
|
|
|
}(); |
2213
|
|
|
|
2214
|
|
|
/** |
2215
|
|
|
`Promise.all` accepts an array of promises, and returns a new promise which |
2216
|
|
|
is fulfilled with an array of fulfillment values for the passed promises, or |
2217
|
|
|
rejected with the reason of the first passed promise to be rejected. It casts all |
2218
|
|
|
elements of the passed iterable to promises as it runs this algorithm. |
2219
|
|
|
|
2220
|
|
|
Example: |
2221
|
|
|
|
2222
|
|
|
```javascript |
2223
|
|
|
let promise1 = resolve(1); |
2224
|
|
|
let promise2 = resolve(2); |
2225
|
|
|
let promise3 = resolve(3); |
2226
|
|
|
let promises = [ promise1, promise2, promise3 ]; |
2227
|
|
|
|
2228
|
|
|
Promise.all(promises).then(function(array){ |
2229
|
|
|
// The array here would be [ 1, 2, 3 ]; |
2230
|
|
|
}); |
2231
|
|
|
``` |
2232
|
|
|
|
2233
|
|
|
If any of the `promises` given to `all` are rejected, the first promise |
2234
|
|
|
that is rejected will be given as an argument to the returned promises's |
2235
|
|
|
rejection handler. For example: |
2236
|
|
|
|
2237
|
|
|
Example: |
2238
|
|
|
|
2239
|
|
|
```javascript |
2240
|
|
|
let promise1 = resolve(1); |
2241
|
|
|
let promise2 = reject(new Error("2")); |
2242
|
|
|
let promise3 = reject(new Error("3")); |
2243
|
|
|
let promises = [ promise1, promise2, promise3 ]; |
2244
|
|
|
|
2245
|
|
|
Promise.all(promises).then(function(array){ |
2246
|
|
|
// Code here never runs because there are rejected promises! |
2247
|
|
|
}, function(error) { |
2248
|
|
|
// error.message === "2" |
2249
|
|
|
}); |
2250
|
|
|
``` |
2251
|
|
|
|
2252
|
|
|
@method all |
2253
|
|
|
@static |
2254
|
|
|
@param {Array} entries array of promises |
2255
|
|
|
@param {String} label optional string for labeling the promise. |
2256
|
|
|
Useful for tooling. |
2257
|
|
|
@return {Promise} promise that is fulfilled when all `promises` have been |
2258
|
|
|
fulfilled, or rejected if any of them become rejected. |
2259
|
|
|
@static |
2260
|
|
|
*/ |
2261
|
|
|
function all(entries) { |
2262
|
|
|
return new Enumerator(this, entries).promise; |
2263
|
|
|
} |
2264
|
|
|
|
2265
|
|
|
/** |
2266
|
|
|
`Promise.race` returns a new promise which is settled in the same way as the |
2267
|
|
|
first passed promise to settle. |
2268
|
|
|
|
2269
|
|
|
Example: |
2270
|
|
|
|
2271
|
|
|
```javascript |
2272
|
|
|
let promise1 = new Promise(function(resolve, reject){ |
2273
|
|
|
setTimeout(function(){ |
2274
|
|
|
resolve('promise 1'); |
2275
|
|
|
}, 200); |
2276
|
|
|
}); |
2277
|
|
|
|
2278
|
|
|
let promise2 = new Promise(function(resolve, reject){ |
2279
|
|
|
setTimeout(function(){ |
2280
|
|
|
resolve('promise 2'); |
2281
|
|
|
}, 100); |
2282
|
|
|
}); |
2283
|
|
|
|
2284
|
|
|
Promise.race([promise1, promise2]).then(function(result){ |
2285
|
|
|
// result === 'promise 2' because it was resolved before promise1 |
2286
|
|
|
// was resolved. |
2287
|
|
|
}); |
2288
|
|
|
``` |
2289
|
|
|
|
2290
|
|
|
`Promise.race` is deterministic in that only the state of the first |
2291
|
|
|
settled promise matters. For example, even if other promises given to the |
2292
|
|
|
`promises` array argument are resolved, but the first settled promise has |
2293
|
|
|
become rejected before the other promises became fulfilled, the returned |
2294
|
|
|
promise will become rejected: |
2295
|
|
|
|
2296
|
|
|
```javascript |
2297
|
|
|
let promise1 = new Promise(function(resolve, reject){ |
2298
|
|
|
setTimeout(function(){ |
2299
|
|
|
resolve('promise 1'); |
2300
|
|
|
}, 200); |
2301
|
|
|
}); |
2302
|
|
|
|
2303
|
|
|
let promise2 = new Promise(function(resolve, reject){ |
2304
|
|
|
setTimeout(function(){ |
2305
|
|
|
reject(new Error('promise 2')); |
2306
|
|
|
}, 100); |
2307
|
|
|
}); |
2308
|
|
|
|
2309
|
|
|
Promise.race([promise1, promise2]).then(function(result){ |
2310
|
|
|
// Code here never runs |
2311
|
|
|
}, function(reason){ |
2312
|
|
|
// reason.message === 'promise 2' because promise 2 became rejected before |
2313
|
|
|
// promise 1 became fulfilled |
2314
|
|
|
}); |
2315
|
|
|
``` |
2316
|
|
|
|
2317
|
|
|
An example real-world use case is implementing timeouts: |
2318
|
|
|
|
2319
|
|
|
```javascript |
2320
|
|
|
Promise.race([ajax('foo.json'), timeout(5000)]) |
2321
|
|
|
``` |
2322
|
|
|
|
2323
|
|
|
@method race |
2324
|
|
|
@static |
2325
|
|
|
@param {Array} promises array of promises to observe |
2326
|
|
|
Useful for tooling. |
2327
|
|
|
@return {Promise} a promise which settles in the same way as the first passed |
2328
|
|
|
promise to settle. |
2329
|
|
|
*/ |
2330
|
|
|
function race(entries) { |
2331
|
|
|
/*jshint validthis:true */ |
2332
|
|
|
var Constructor = this; |
2333
|
|
|
|
2334
|
|
|
if (!isArray(entries)) { |
2335
|
|
|
return new Constructor(function (_, reject) { |
2336
|
|
|
return reject(new TypeError('You must pass an array to race.')); |
2337
|
|
|
}); |
2338
|
|
|
} else { |
2339
|
|
|
return new Constructor(function (resolve, reject) { |
2340
|
|
|
var length = entries.length; |
2341
|
|
|
for (var i = 0; i < length; i++) { |
2342
|
|
|
Constructor.resolve(entries[i]).then(resolve, reject); |
2343
|
|
|
} |
2344
|
|
|
}); |
2345
|
|
|
} |
2346
|
|
|
} |
2347
|
|
|
|
2348
|
|
|
/** |
2349
|
|
|
`Promise.reject` returns a promise rejected with the passed `reason`. |
2350
|
|
|
It is shorthand for the following: |
2351
|
|
|
|
2352
|
|
|
```javascript |
2353
|
|
|
let promise = new Promise(function(resolve, reject){ |
2354
|
|
|
reject(new Error('WHOOPS')); |
2355
|
|
|
}); |
2356
|
|
|
|
2357
|
|
|
promise.then(function(value){ |
2358
|
|
|
// Code here doesn't run because the promise is rejected! |
2359
|
|
|
}, function(reason){ |
2360
|
|
|
// reason.message === 'WHOOPS' |
2361
|
|
|
}); |
2362
|
|
|
``` |
2363
|
|
|
|
2364
|
|
|
Instead of writing the above, your code now simply becomes the following: |
2365
|
|
|
|
2366
|
|
|
```javascript |
2367
|
|
|
let promise = Promise.reject(new Error('WHOOPS')); |
2368
|
|
|
|
2369
|
|
|
promise.then(function(value){ |
2370
|
|
|
// Code here doesn't run because the promise is rejected! |
2371
|
|
|
}, function(reason){ |
2372
|
|
|
// reason.message === 'WHOOPS' |
2373
|
|
|
}); |
2374
|
|
|
``` |
2375
|
|
|
|
2376
|
|
|
@method reject |
2377
|
|
|
@static |
2378
|
|
|
@param {Any} reason value that the returned promise will be rejected with. |
2379
|
|
|
Useful for tooling. |
2380
|
|
|
@return {Promise} a promise rejected with the given `reason`. |
2381
|
|
|
*/ |
2382
|
|
|
function reject$1(reason) { |
2383
|
|
|
/*jshint validthis:true */ |
2384
|
|
|
var Constructor = this; |
2385
|
|
|
var promise = new Constructor(noop); |
2386
|
|
|
reject(promise, reason); |
2387
|
|
|
return promise; |
2388
|
|
|
} |
2389
|
|
|
|
2390
|
|
|
function needsResolver() { |
2391
|
|
|
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); |
2392
|
|
|
} |
2393
|
|
|
|
2394
|
|
|
function needsNew() { |
2395
|
|
|
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); |
2396
|
|
|
} |
2397
|
|
|
|
2398
|
|
|
/** |
2399
|
|
|
Promise objects represent the eventual result of an asynchronous operation. The |
2400
|
|
|
primary way of interacting with a promise is through its `then` method, which |
2401
|
|
|
registers callbacks to receive either a promise's eventual value or the reason |
2402
|
|
|
why the promise cannot be fulfilled. |
2403
|
|
|
|
2404
|
|
|
Terminology |
2405
|
|
|
----------- |
2406
|
|
|
|
2407
|
|
|
- `promise` is an object or function with a `then` method whose behavior conforms to this specification. |
2408
|
|
|
- `thenable` is an object or function that defines a `then` method. |
2409
|
|
|
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise). |
2410
|
|
|
- `exception` is a value that is thrown using the throw statement. |
2411
|
|
|
- `reason` is a value that indicates why a promise was rejected. |
2412
|
|
|
- `settled` the final resting state of a promise, fulfilled or rejected. |
2413
|
|
|
|
2414
|
|
|
A promise can be in one of three states: pending, fulfilled, or rejected. |
2415
|
|
|
|
2416
|
|
|
Promises that are fulfilled have a fulfillment value and are in the fulfilled |
2417
|
|
|
state. Promises that are rejected have a rejection reason and are in the |
2418
|
|
|
rejected state. A fulfillment value is never a thenable. |
2419
|
|
|
|
2420
|
|
|
Promises can also be said to *resolve* a value. If this value is also a |
2421
|
|
|
promise, then the original promise's settled state will match the value's |
2422
|
|
|
settled state. So a promise that *resolves* a promise that rejects will |
2423
|
|
|
itself reject, and a promise that *resolves* a promise that fulfills will |
2424
|
|
|
itself fulfill. |
2425
|
|
|
|
2426
|
|
|
|
2427
|
|
|
Basic Usage: |
2428
|
|
|
------------ |
2429
|
|
|
|
2430
|
|
|
```js |
2431
|
|
|
let promise = new Promise(function(resolve, reject) { |
2432
|
|
|
// on success |
2433
|
|
|
resolve(value); |
2434
|
|
|
|
2435
|
|
|
// on failure |
2436
|
|
|
reject(reason); |
2437
|
|
|
}); |
2438
|
|
|
|
2439
|
|
|
promise.then(function(value) { |
2440
|
|
|
// on fulfillment |
2441
|
|
|
}, function(reason) { |
2442
|
|
|
// on rejection |
2443
|
|
|
}); |
2444
|
|
|
``` |
2445
|
|
|
|
2446
|
|
|
Advanced Usage: |
2447
|
|
|
--------------- |
2448
|
|
|
|
2449
|
|
|
Promises shine when abstracting away asynchronous interactions such as |
2450
|
|
|
`XMLHttpRequest`s. |
2451
|
|
|
|
2452
|
|
|
```js |
2453
|
|
|
function getJSON(url) { |
2454
|
|
|
return new Promise(function(resolve, reject){ |
2455
|
|
|
let xhr = new XMLHttpRequest(); |
2456
|
|
|
|
2457
|
|
|
xhr.open('GET', url); |
2458
|
|
|
xhr.onreadystatechange = handler; |
2459
|
|
|
xhr.responseType = 'json'; |
2460
|
|
|
xhr.setRequestHeader('Accept', 'application/json'); |
2461
|
|
|
xhr.send(); |
2462
|
|
|
|
2463
|
|
|
function handler() { |
2464
|
|
|
if (this.readyState === this.DONE) { |
2465
|
|
|
if (this.status === 200) { |
2466
|
|
|
resolve(this.response); |
2467
|
|
|
} else { |
2468
|
|
|
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); |
2469
|
|
|
} |
2470
|
|
|
} |
2471
|
|
|
}; |
2472
|
|
|
}); |
2473
|
|
|
} |
2474
|
|
|
|
2475
|
|
|
getJSON('/posts.json').then(function(json) { |
2476
|
|
|
// on fulfillment |
2477
|
|
|
}, function(reason) { |
2478
|
|
|
// on rejection |
2479
|
|
|
}); |
2480
|
|
|
``` |
2481
|
|
|
|
2482
|
|
|
Unlike callbacks, promises are great composable primitives. |
2483
|
|
|
|
2484
|
|
|
```js |
2485
|
|
|
Promise.all([ |
2486
|
|
|
getJSON('/posts'), |
2487
|
|
|
getJSON('/comments') |
2488
|
|
|
]).then(function(values){ |
2489
|
|
|
values[0] // => postsJSON |
2490
|
|
|
values[1] // => commentsJSON |
2491
|
|
|
|
2492
|
|
|
return values; |
2493
|
|
|
}); |
2494
|
|
|
``` |
2495
|
|
|
|
2496
|
|
|
@class Promise |
2497
|
|
|
@param {Function} resolver |
2498
|
|
|
Useful for tooling. |
2499
|
|
|
@constructor |
2500
|
|
|
*/ |
2501
|
|
|
|
2502
|
|
|
var Promise$1 = function () { |
2503
|
|
|
function Promise(resolver) { |
2504
|
|
|
this[PROMISE_ID] = nextId(); |
2505
|
|
|
this._result = this._state = undefined; |
2506
|
|
|
this._subscribers = []; |
2507
|
|
|
|
2508
|
|
|
if (noop !== resolver) { |
2509
|
|
|
typeof resolver !== 'function' && needsResolver(); |
2510
|
|
|
this instanceof Promise ? initializePromise(this, resolver) : needsNew(); |
2511
|
|
|
} |
2512
|
|
|
} |
2513
|
|
|
|
2514
|
|
|
/** |
2515
|
|
|
The primary way of interacting with a promise is through its `then` method, |
2516
|
|
|
which registers callbacks to receive either a promise's eventual value or the |
2517
|
|
|
reason why the promise cannot be fulfilled. |
2518
|
|
|
```js |
2519
|
|
|
findUser().then(function(user){ |
2520
|
|
|
// user is available |
2521
|
|
|
}, function(reason){ |
2522
|
|
|
// user is unavailable, and you are given the reason why |
2523
|
|
|
}); |
2524
|
|
|
``` |
2525
|
|
|
Chaining |
2526
|
|
|
-------- |
2527
|
|
|
The return value of `then` is itself a promise. This second, 'downstream' |
2528
|
|
|
promise is resolved with the return value of the first promise's fulfillment |
2529
|
|
|
or rejection handler, or rejected if the handler throws an exception. |
2530
|
|
|
```js |
2531
|
|
|
findUser().then(function (user) { |
2532
|
|
|
return user.name; |
2533
|
|
|
}, function (reason) { |
2534
|
|
|
return 'default name'; |
2535
|
|
|
}).then(function (userName) { |
2536
|
|
|
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it |
2537
|
|
|
// will be `'default name'` |
2538
|
|
|
}); |
2539
|
|
|
findUser().then(function (user) { |
2540
|
|
|
throw new Error('Found user, but still unhappy'); |
2541
|
|
|
}, function (reason) { |
2542
|
|
|
throw new Error('`findUser` rejected and we're unhappy'); |
2543
|
|
|
}).then(function (value) { |
2544
|
|
|
// never reached |
2545
|
|
|
}, function (reason) { |
2546
|
|
|
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. |
2547
|
|
|
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. |
2548
|
|
|
}); |
2549
|
|
|
``` |
2550
|
|
|
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. |
2551
|
|
|
```js |
2552
|
|
|
findUser().then(function (user) { |
2553
|
|
|
throw new PedagogicalException('Upstream error'); |
2554
|
|
|
}).then(function (value) { |
2555
|
|
|
// never reached |
2556
|
|
|
}).then(function (value) { |
2557
|
|
|
// never reached |
2558
|
|
|
}, function (reason) { |
2559
|
|
|
// The `PedgagocialException` is propagated all the way down to here |
2560
|
|
|
}); |
2561
|
|
|
``` |
2562
|
|
|
Assimilation |
2563
|
|
|
------------ |
2564
|
|
|
Sometimes the value you want to propagate to a downstream promise can only be |
2565
|
|
|
retrieved asynchronously. This can be achieved by returning a promise in the |
2566
|
|
|
fulfillment or rejection handler. The downstream promise will then be pending |
2567
|
|
|
until the returned promise is settled. This is called *assimilation*. |
2568
|
|
|
```js |
2569
|
|
|
findUser().then(function (user) { |
2570
|
|
|
return findCommentsByAuthor(user); |
2571
|
|
|
}).then(function (comments) { |
2572
|
|
|
// The user's comments are now available |
2573
|
|
|
}); |
2574
|
|
|
``` |
2575
|
|
|
If the assimliated promise rejects, then the downstream promise will also reject. |
2576
|
|
|
```js |
2577
|
|
|
findUser().then(function (user) { |
2578
|
|
|
return findCommentsByAuthor(user); |
2579
|
|
|
}).then(function (comments) { |
2580
|
|
|
// If `findCommentsByAuthor` fulfills, we'll have the value here |
2581
|
|
|
}, function (reason) { |
2582
|
|
|
// If `findCommentsByAuthor` rejects, we'll have the reason here |
2583
|
|
|
}); |
2584
|
|
|
``` |
2585
|
|
|
Simple Example |
2586
|
|
|
-------------- |
2587
|
|
|
Synchronous Example |
2588
|
|
|
```javascript |
2589
|
|
|
let result; |
2590
|
|
|
try { |
2591
|
|
|
result = findResult(); |
2592
|
|
|
// success |
2593
|
|
|
} catch(reason) { |
2594
|
|
|
// failure |
2595
|
|
|
} |
2596
|
|
|
``` |
2597
|
|
|
Errback Example |
2598
|
|
|
```js |
2599
|
|
|
findResult(function(result, err){ |
2600
|
|
|
if (err) { |
2601
|
|
|
// failure |
2602
|
|
|
} else { |
2603
|
|
|
// success |
2604
|
|
|
} |
2605
|
|
|
}); |
2606
|
|
|
``` |
2607
|
|
|
Promise Example; |
2608
|
|
|
```javascript |
2609
|
|
|
findResult().then(function(result){ |
2610
|
|
|
// success |
2611
|
|
|
}, function(reason){ |
2612
|
|
|
// failure |
2613
|
|
|
}); |
2614
|
|
|
``` |
2615
|
|
|
Advanced Example |
2616
|
|
|
-------------- |
2617
|
|
|
Synchronous Example |
2618
|
|
|
```javascript |
2619
|
|
|
let author, books; |
2620
|
|
|
try { |
2621
|
|
|
author = findAuthor(); |
2622
|
|
|
books = findBooksByAuthor(author); |
2623
|
|
|
// success |
2624
|
|
|
} catch(reason) { |
2625
|
|
|
// failure |
2626
|
|
|
} |
2627
|
|
|
``` |
2628
|
|
|
Errback Example |
2629
|
|
|
```js |
2630
|
|
|
function foundBooks(books) { |
2631
|
|
|
} |
2632
|
|
|
function failure(reason) { |
2633
|
|
|
} |
2634
|
|
|
findAuthor(function(author, err){ |
2635
|
|
|
if (err) { |
2636
|
|
|
failure(err); |
2637
|
|
|
// failure |
2638
|
|
|
} else { |
2639
|
|
|
try { |
2640
|
|
|
findBoooksByAuthor(author, function(books, err) { |
2641
|
|
|
if (err) { |
2642
|
|
|
failure(err); |
2643
|
|
|
} else { |
2644
|
|
|
try { |
2645
|
|
|
foundBooks(books); |
2646
|
|
|
} catch(reason) { |
2647
|
|
|
failure(reason); |
2648
|
|
|
} |
2649
|
|
|
} |
2650
|
|
|
}); |
2651
|
|
|
} catch(error) { |
2652
|
|
|
failure(err); |
2653
|
|
|
} |
2654
|
|
|
// success |
2655
|
|
|
} |
2656
|
|
|
}); |
2657
|
|
|
``` |
2658
|
|
|
Promise Example; |
2659
|
|
|
```javascript |
2660
|
|
|
findAuthor(). |
2661
|
|
|
then(findBooksByAuthor). |
2662
|
|
|
then(function(books){ |
2663
|
|
|
// found books |
2664
|
|
|
}).catch(function(reason){ |
2665
|
|
|
// something went wrong |
2666
|
|
|
}); |
2667
|
|
|
``` |
2668
|
|
|
@method then |
2669
|
|
|
@param {Function} onFulfilled |
2670
|
|
|
@param {Function} onRejected |
2671
|
|
|
Useful for tooling. |
2672
|
|
|
@return {Promise} |
2673
|
|
|
*/ |
2674
|
|
|
|
2675
|
|
|
/** |
2676
|
|
|
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same |
2677
|
|
|
as the catch block of a try/catch statement. |
2678
|
|
|
```js |
2679
|
|
|
function findAuthor(){ |
2680
|
|
|
throw new Error('couldn't find that author'); |
2681
|
|
|
} |
2682
|
|
|
// synchronous |
2683
|
|
|
try { |
2684
|
|
|
findAuthor(); |
2685
|
|
|
} catch(reason) { |
2686
|
|
|
// something went wrong |
2687
|
|
|
} |
2688
|
|
|
// async with promises |
2689
|
|
|
findAuthor().catch(function(reason){ |
2690
|
|
|
// something went wrong |
2691
|
|
|
}); |
2692
|
|
|
``` |
2693
|
|
|
@method catch |
2694
|
|
|
@param {Function} onRejection |
2695
|
|
|
Useful for tooling. |
2696
|
|
|
@return {Promise} |
2697
|
|
|
*/ |
2698
|
|
|
|
2699
|
|
|
|
2700
|
|
|
Promise.prototype.catch = function _catch(onRejection) { |
2701
|
|
|
return this.then(null, onRejection); |
2702
|
|
|
}; |
2703
|
|
|
|
2704
|
|
|
/** |
2705
|
|
|
`finally` will be invoked regardless of the promise's fate just as native |
2706
|
|
|
try/catch/finally behaves |
2707
|
|
|
|
2708
|
|
|
Synchronous example: |
2709
|
|
|
|
2710
|
|
|
```js |
2711
|
|
|
findAuthor() { |
2712
|
|
|
if (Math.random() > 0.5) { |
2713
|
|
|
throw new Error(); |
2714
|
|
|
} |
2715
|
|
|
return new Author(); |
2716
|
|
|
} |
2717
|
|
|
|
2718
|
|
|
try { |
2719
|
|
|
return findAuthor(); // succeed or fail |
2720
|
|
|
} catch(error) { |
2721
|
|
|
return findOtherAuther(); |
2722
|
|
|
} finally { |
2723
|
|
|
// always runs |
2724
|
|
|
// doesn't affect the return value |
2725
|
|
|
} |
2726
|
|
|
``` |
2727
|
|
|
|
2728
|
|
|
Asynchronous example: |
2729
|
|
|
|
2730
|
|
|
```js |
2731
|
|
|
findAuthor().catch(function(reason){ |
2732
|
|
|
return findOtherAuther(); |
2733
|
|
|
}).finally(function(){ |
2734
|
|
|
// author was either found, or not |
2735
|
|
|
}); |
2736
|
|
|
``` |
2737
|
|
|
|
2738
|
|
|
@method finally |
2739
|
|
|
@param {Function} callback |
2740
|
|
|
@return {Promise} |
2741
|
|
|
*/ |
2742
|
|
|
|
2743
|
|
|
|
2744
|
|
|
Promise.prototype.finally = function _finally(callback) { |
2745
|
|
|
var promise = this; |
2746
|
|
|
var constructor = promise.constructor; |
2747
|
|
|
|
2748
|
|
|
if (isFunction(callback)) { |
2749
|
|
|
return promise.then(function (value) { |
2750
|
|
|
return constructor.resolve(callback()).then(function () { |
2751
|
|
|
return value; |
2752
|
|
|
}); |
2753
|
|
|
}, function (reason) { |
2754
|
|
|
return constructor.resolve(callback()).then(function () { |
2755
|
|
|
throw reason; |
2756
|
|
|
}); |
2757
|
|
|
}); |
2758
|
|
|
} |
2759
|
|
|
|
2760
|
|
|
return promise.then(callback, callback); |
2761
|
|
|
}; |
2762
|
|
|
|
2763
|
|
|
return Promise; |
2764
|
|
|
}(); |
2765
|
|
|
|
2766
|
|
|
Promise$1.prototype.then = then; |
2767
|
|
|
Promise$1.all = all; |
2768
|
|
|
Promise$1.race = race; |
2769
|
|
|
Promise$1.resolve = resolve$1; |
2770
|
|
|
Promise$1.reject = reject$1; |
2771
|
|
|
Promise$1._setScheduler = setScheduler; |
2772
|
|
|
Promise$1._setAsap = setAsap; |
2773
|
|
|
Promise$1._asap = asap; |
2774
|
|
|
|
2775
|
|
|
/*global self*/ |
2776
|
|
|
function polyfill() { |
2777
|
|
|
var local = void 0; |
2778
|
|
|
|
2779
|
|
|
if (typeof global !== 'undefined') { |
2780
|
|
|
local = global; |
2781
|
|
|
} else if (typeof self !== 'undefined') { |
2782
|
|
|
local = self; |
2783
|
|
|
} else { |
2784
|
|
|
try { |
2785
|
|
|
local = Function('return this')(); |
2786
|
|
|
} catch (e) { |
2787
|
|
|
throw new Error('polyfill failed because global object is unavailable in this environment'); |
2788
|
|
|
} |
2789
|
|
|
} |
2790
|
|
|
|
2791
|
|
|
var P = local.Promise; |
2792
|
|
|
|
2793
|
|
|
if (P) { |
2794
|
|
|
var promiseToString = null; |
2795
|
|
|
try { |
2796
|
|
|
promiseToString = Object.prototype.toString.call(P.resolve()); |
2797
|
|
|
} catch (e) { |
2798
|
|
|
// silently ignored |
2799
|
|
|
} |
2800
|
|
|
|
2801
|
|
|
if (promiseToString === '[object Promise]' && !P.cast) { |
2802
|
|
|
return; |
2803
|
|
|
} |
2804
|
|
|
} |
2805
|
|
|
|
2806
|
|
|
local.Promise = Promise$1; |
2807
|
|
|
} |
2808
|
|
|
|
2809
|
|
|
// Strange compat.. |
2810
|
|
|
Promise$1.polyfill = polyfill; |
2811
|
|
|
Promise$1.Promise = Promise$1; |
2812
|
|
|
|
2813
|
|
|
return Promise$1; |
2814
|
|
|
|
2815
|
|
|
}))); |
2816
|
|
|
|
2817
|
|
|
|
2818
|
|
|
|
2819
|
|
|
//# sourceMappingURL=es6-promise.map |
2820
|
|
|
|
2821
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/process/browser.js"), __webpack_require__("./node_modules/webpack/buildin/global.js"))) |
2822
|
|
|
|
2823
|
|
|
/***/ }), |
2824
|
|
|
|
2825
|
|
|
/***/ "./node_modules/is-buffer/index.js": |
2826
|
|
|
/***/ (function(module, exports) { |
2827
|
|
|
|
2828
|
|
|
/*! |
2829
|
|
|
* Determine if an object is a Buffer |
2830
|
|
|
* |
2831
|
|
|
* @author Feross Aboukhadijeh <https://feross.org> |
2832
|
|
|
* @license MIT |
2833
|
|
|
*/ |
2834
|
|
|
|
2835
|
|
|
// The _isBuffer check is for Safari 5-7 support, because it's missing |
2836
|
|
|
// Object.prototype.constructor. Remove this eventually |
2837
|
|
|
module.exports = function (obj) { |
2838
|
|
|
return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) |
2839
|
|
|
} |
2840
|
|
|
|
2841
|
|
|
function isBuffer (obj) { |
2842
|
|
|
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) |
2843
|
|
|
} |
2844
|
|
|
|
2845
|
|
|
// For Node v0.10 support. Remove this eventually. |
2846
|
|
|
function isSlowBuffer (obj) { |
2847
|
|
|
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) |
2848
|
|
|
} |
2849
|
|
|
|
2850
|
|
|
|
2851
|
|
|
/***/ }), |
2852
|
|
|
|
2853
|
|
|
/***/ "./node_modules/process/browser.js": |
2854
|
|
|
/***/ (function(module, exports) { |
2855
|
|
|
|
2856
|
|
|
// shim for using process in browser |
2857
|
|
|
var process = module.exports = {}; |
2858
|
|
|
|
2859
|
|
|
// cached from whatever global is present so that test runners that stub it |
2860
|
|
|
// don't break things. But we need to wrap it in a try catch in case it is |
2861
|
|
|
// wrapped in strict mode code which doesn't define any globals. It's inside a |
2862
|
|
|
// function because try/catches deoptimize in certain engines. |
2863
|
|
|
|
2864
|
|
|
var cachedSetTimeout; |
2865
|
|
|
var cachedClearTimeout; |
2866
|
|
|
|
2867
|
|
|
function defaultSetTimout() { |
2868
|
|
|
throw new Error('setTimeout has not been defined'); |
2869
|
|
|
} |
2870
|
|
|
function defaultClearTimeout () { |
2871
|
|
|
throw new Error('clearTimeout has not been defined'); |
2872
|
|
|
} |
2873
|
|
|
(function () { |
2874
|
|
|
try { |
2875
|
|
|
if (typeof setTimeout === 'function') { |
2876
|
|
|
cachedSetTimeout = setTimeout; |
2877
|
|
|
} else { |
2878
|
|
|
cachedSetTimeout = defaultSetTimout; |
2879
|
|
|
} |
2880
|
|
|
} catch (e) { |
2881
|
|
|
cachedSetTimeout = defaultSetTimout; |
2882
|
|
|
} |
2883
|
|
|
try { |
2884
|
|
|
if (typeof clearTimeout === 'function') { |
2885
|
|
|
cachedClearTimeout = clearTimeout; |
2886
|
|
|
} else { |
2887
|
|
|
cachedClearTimeout = defaultClearTimeout; |
2888
|
|
|
} |
2889
|
|
|
} catch (e) { |
2890
|
|
|
cachedClearTimeout = defaultClearTimeout; |
2891
|
|
|
} |
2892
|
|
|
} ()) |
2893
|
|
|
function runTimeout(fun) { |
2894
|
|
|
if (cachedSetTimeout === setTimeout) { |
2895
|
|
|
//normal enviroments in sane situations |
2896
|
|
|
return setTimeout(fun, 0); |
2897
|
|
|
} |
2898
|
|
|
// if setTimeout wasn't available but was latter defined |
2899
|
|
|
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { |
2900
|
|
|
cachedSetTimeout = setTimeout; |
2901
|
|
|
return setTimeout(fun, 0); |
2902
|
|
|
} |
2903
|
|
|
try { |
2904
|
|
|
// when when somebody has screwed with setTimeout but no I.E. maddness |
2905
|
|
|
return cachedSetTimeout(fun, 0); |
2906
|
|
|
} catch(e){ |
2907
|
|
|
try { |
2908
|
|
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally |
2909
|
|
|
return cachedSetTimeout.call(null, fun, 0); |
2910
|
|
|
} catch(e){ |
2911
|
|
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error |
2912
|
|
|
return cachedSetTimeout.call(this, fun, 0); |
2913
|
|
|
} |
2914
|
|
|
} |
2915
|
|
|
|
2916
|
|
|
|
2917
|
|
|
} |
2918
|
|
|
function runClearTimeout(marker) { |
2919
|
|
|
if (cachedClearTimeout === clearTimeout) { |
2920
|
|
|
//normal enviroments in sane situations |
2921
|
|
|
return clearTimeout(marker); |
2922
|
|
|
} |
2923
|
|
|
// if clearTimeout wasn't available but was latter defined |
2924
|
|
|
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { |
2925
|
|
|
cachedClearTimeout = clearTimeout; |
2926
|
|
|
return clearTimeout(marker); |
2927
|
|
|
} |
2928
|
|
|
try { |
2929
|
|
|
// when when somebody has screwed with setTimeout but no I.E. maddness |
2930
|
|
|
return cachedClearTimeout(marker); |
2931
|
|
|
} catch (e){ |
2932
|
|
|
try { |
2933
|
|
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally |
2934
|
|
|
return cachedClearTimeout.call(null, marker); |
2935
|
|
|
} catch (e){ |
2936
|
|
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. |
2937
|
|
|
// Some versions of I.E. have different rules for clearTimeout vs setTimeout |
2938
|
|
|
return cachedClearTimeout.call(this, marker); |
2939
|
|
|
} |
2940
|
|
|
} |
2941
|
|
|
|
2942
|
|
|
|
2943
|
|
|
|
2944
|
|
|
} |
2945
|
|
|
var queue = []; |
2946
|
|
|
var draining = false; |
2947
|
|
|
var currentQueue; |
2948
|
|
|
var queueIndex = -1; |
2949
|
|
|
|
2950
|
|
|
function cleanUpNextTick() { |
2951
|
|
|
if (!draining || !currentQueue) { |
2952
|
|
|
return; |
2953
|
|
|
} |
2954
|
|
|
draining = false; |
2955
|
|
|
if (currentQueue.length) { |
2956
|
|
|
queue = currentQueue.concat(queue); |
2957
|
|
|
} else { |
2958
|
|
|
queueIndex = -1; |
2959
|
|
|
} |
2960
|
|
|
if (queue.length) { |
2961
|
|
|
drainQueue(); |
2962
|
|
|
} |
2963
|
|
|
} |
2964
|
|
|
|
2965
|
|
|
function drainQueue() { |
2966
|
|
|
if (draining) { |
2967
|
|
|
return; |
2968
|
|
|
} |
2969
|
|
|
var timeout = runTimeout(cleanUpNextTick); |
2970
|
|
|
draining = true; |
2971
|
|
|
|
2972
|
|
|
var len = queue.length; |
2973
|
|
|
while(len) { |
2974
|
|
|
currentQueue = queue; |
2975
|
|
|
queue = []; |
2976
|
|
|
while (++queueIndex < len) { |
2977
|
|
|
if (currentQueue) { |
2978
|
|
|
currentQueue[queueIndex].run(); |
2979
|
|
|
} |
2980
|
|
|
} |
2981
|
|
|
queueIndex = -1; |
2982
|
|
|
len = queue.length; |
2983
|
|
|
} |
2984
|
|
|
currentQueue = null; |
2985
|
|
|
draining = false; |
2986
|
|
|
runClearTimeout(timeout); |
2987
|
|
|
} |
2988
|
|
|
|
2989
|
|
|
process.nextTick = function (fun) { |
2990
|
|
|
var args = new Array(arguments.length - 1); |
2991
|
|
|
if (arguments.length > 1) { |
2992
|
|
|
for (var i = 1; i < arguments.length; i++) { |
2993
|
|
|
args[i - 1] = arguments[i]; |
2994
|
|
|
} |
2995
|
|
|
} |
2996
|
|
|
queue.push(new Item(fun, args)); |
2997
|
|
|
if (queue.length === 1 && !draining) { |
2998
|
|
|
runTimeout(drainQueue); |
2999
|
|
|
} |
3000
|
|
|
}; |
3001
|
|
|
|
3002
|
|
|
// v8 likes predictible objects |
3003
|
|
|
function Item(fun, array) { |
3004
|
|
|
this.fun = fun; |
3005
|
|
|
this.array = array; |
3006
|
|
|
} |
3007
|
|
|
Item.prototype.run = function () { |
3008
|
|
|
this.fun.apply(null, this.array); |
3009
|
|
|
}; |
3010
|
|
|
process.title = 'browser'; |
3011
|
|
|
process.browser = true; |
3012
|
|
|
process.env = {}; |
3013
|
|
|
process.argv = []; |
3014
|
|
|
process.version = ''; // empty string to avoid regexp issues |
3015
|
|
|
process.versions = {}; |
3016
|
|
|
|
3017
|
|
|
function noop() {} |
3018
|
|
|
|
3019
|
|
|
process.on = noop; |
3020
|
|
|
process.addListener = noop; |
3021
|
|
|
process.once = noop; |
3022
|
|
|
process.off = noop; |
3023
|
|
|
process.removeListener = noop; |
3024
|
|
|
process.removeAllListeners = noop; |
3025
|
|
|
process.emit = noop; |
3026
|
|
|
process.prependListener = noop; |
3027
|
|
|
process.prependOnceListener = noop; |
3028
|
|
|
|
3029
|
|
|
process.listeners = function (name) { return [] } |
3030
|
|
|
|
3031
|
|
|
process.binding = function (name) { |
3032
|
|
|
throw new Error('process.binding is not supported'); |
3033
|
|
|
}; |
3034
|
|
|
|
3035
|
|
|
process.cwd = function () { return '/' }; |
3036
|
|
|
process.chdir = function (dir) { |
3037
|
|
|
throw new Error('process.chdir is not supported'); |
3038
|
|
|
}; |
3039
|
|
|
process.umask = function() { return 0; }; |
3040
|
|
|
|
3041
|
|
|
|
3042
|
|
|
/***/ }), |
3043
|
|
|
|
3044
|
|
|
/***/ "./node_modules/webpack/buildin/global.js": |
3045
|
|
|
/***/ (function(module, exports) { |
3046
|
|
|
|
3047
|
|
|
var g; |
3048
|
|
|
|
3049
|
|
|
// This works in non-strict mode |
3050
|
|
|
g = (function() { |
3051
|
|
|
return this; |
3052
|
|
|
})(); |
3053
|
|
|
|
3054
|
|
|
try { |
3055
|
|
|
// This works if eval is allowed (see CSP) |
3056
|
|
|
g = g || Function("return this")() || (1,eval)("this"); |
3057
|
|
|
} catch(e) { |
3058
|
|
|
// This works if the window reference is available |
3059
|
|
|
if(typeof window === "object") |
3060
|
|
|
g = window; |
3061
|
|
|
} |
3062
|
|
|
|
3063
|
|
|
// g can still be undefined, but nothing to do about it... |
3064
|
|
|
// We return undefined, instead of nothing here, so it's |
3065
|
|
|
// easier to handle this case. if(!global) { ...} |
3066
|
|
|
|
3067
|
|
|
module.exports = g; |
3068
|
|
|
|
3069
|
|
|
|
3070
|
|
|
/***/ }), |
3071
|
|
|
|
3072
|
|
|
/***/ "./resources/assets/js/bootstrap.js": |
3073
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
3074
|
|
|
|
3075
|
|
|
// window._ = require('lodash'); |
3076
|
|
|
|
3077
|
|
|
/** |
3078
|
|
|
* We'll load jQuery and the Bootstrap jQuery plugin which provides support |
3079
|
|
|
* for JavaScript based Bootstrap features such as modals and tabs. This |
3080
|
|
|
* code may be modified to fit the specific needs of your application. |
3081
|
|
|
*/ |
3082
|
|
|
|
3083
|
|
|
// try { |
3084
|
|
|
// window.$ = window.jQuery = require('jquery'); |
3085
|
|
|
// |
3086
|
|
|
// require('bootstrap-sass'); |
3087
|
|
|
// } catch (e) {} |
3088
|
|
|
|
3089
|
|
|
// Load Polyfill for E6 Promises |
3090
|
|
|
__webpack_require__("./node_modules/es6-promise/dist/es6-promise.js").polyfill(); |
3091
|
|
|
|
3092
|
|
|
/** |
3093
|
|
|
* We'll load the axios HTTP library which allows us to easily issue requests |
3094
|
|
|
* to our Laravel back-end. This library automatically handles sending the |
3095
|
|
|
* CSRF token as a header based on the value of the "XSRF" token cookie. |
3096
|
|
|
*/ |
3097
|
|
|
|
3098
|
|
|
window.axios = __webpack_require__("./node_modules/axios/index.js"); |
3099
|
|
|
|
3100
|
|
|
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; |
3101
|
|
|
|
3102
|
|
|
/** |
3103
|
|
|
* Next we will register the CSRF Token as a common header with Axios so that |
3104
|
|
|
* all outgoing HTTP requests automatically have it attached. This is just |
3105
|
|
|
* a simple convenience so we don't have to attach every token manually. |
3106
|
|
|
*/ |
3107
|
|
|
|
3108
|
|
|
var token = document.head.querySelector('meta[name="csrf-token"]'); |
3109
|
|
|
|
3110
|
|
|
if (token) { |
3111
|
|
|
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; |
3112
|
|
|
} else { |
3113
|
|
|
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); |
3114
|
|
|
} |
3115
|
|
|
|
3116
|
|
|
/** |
3117
|
|
|
* Echo exposes an expressive API for subscribing to channels and listening |
3118
|
|
|
* for events that are broadcast by Laravel. Echo and event broadcasting |
3119
|
|
|
* allows your team to easily build robust real-time web applications. |
3120
|
|
|
*/ |
3121
|
|
|
|
3122
|
|
|
// import Echo from 'laravel-echo' |
3123
|
|
|
|
3124
|
|
|
// window.Pusher = require('pusher-js'); |
3125
|
|
|
|
3126
|
|
|
// window.Echo = new Echo({ |
3127
|
|
|
// broadcaster: 'pusher', |
3128
|
|
|
// key: 'your-pusher-key', |
3129
|
|
|
// cluster: 'mt1', |
3130
|
|
|
// encrypted: true |
3131
|
|
|
// }); |
3132
|
|
|
|
3133
|
|
|
/***/ }), |
3134
|
|
|
|
3135
|
|
|
/***/ "./resources/assets/sass/app.scss": |
3136
|
|
|
/***/ (function(module, exports) { |
3137
|
|
|
|
3138
|
|
|
// removed by extract-text-webpack-plugin |
3139
|
|
|
|
3140
|
|
|
/***/ }), |
3141
|
|
|
|
3142
|
|
|
/***/ 0: |
3143
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
3144
|
|
|
|
3145
|
|
|
__webpack_require__("./resources/assets/js/bootstrap.js"); |
3146
|
|
|
module.exports = __webpack_require__("./resources/assets/sass/app.scss"); |
3147
|
|
|
|
3148
|
|
|
|
3149
|
|
|
/***/ }) |
3150
|
|
|
|
3151
|
|
|
/******/ }); |